Repository navigation
Commit 0ab4e38
committed
Summarize statistics events in linear time
describe_statistics() joined each test case's events with
sum(lists, []), which copies everything joined so far at every step,
so it took time quadratic in the number of test cases. The pytest
plugin calls it for every Hypothesis test, with or without
--hypothesis-show-statistics, so long runs paused after their last
example: about 21 seconds at 100,000 examples and over 2.5 minutes at
200,000, on a MacBook M1 with 8 cores. Chaining the lists instead
gives the same counts in linear time.
Co-Authored-By: Claude Opus 5.5 <[email protected]>1 parent 32ebeb2 commit 0ab4e38
2 files changed
Lines changed: 26 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
108 | 109 | | |
109 | 110 | | |
110 | 111 | | |
111 | | - | |
| 112 | + | |
112 | 113 | | |
113 | 114 | | |
114 | 115 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
312 | 312 | | |
313 | 313 | | |
314 | 314 | | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
0 commit comments