Commit 5d345e7
authored
rfac: Performance improvement to
* Add performance tests for Histogram method `recalculateBins` and run `swift test --generate-linuxmain`.
* rfac: Faster algorithm for `recalculateBins` which is one of the main culprits in slowing down the tests.
* rfac: Add `isSorted` flag to `HistogramSeries` and improve the performance of `recalculateBins`
This flag is set if `data` is sorted and unset if the user sets the `data` property on the series manually, it is used to choose the fastest algorithm for `recalculateBins`.
* rfac: Clean up calculateSeriesData.
* docs: Add comments explaining both algorithms and their performance.
* chor: val -> value
* rfac: use `max` function and in the second algorithm hoist it out of the loop for better performance. Improve/update comments.
* Attempt to add Big-O notation to the algorithms... is this right?
* doc: add comment
* doc: update comment
* change class back to struct and run `swift test --generate-linuxmain`
* [docs][chor] improve comment on `isSorted` and change `true` to `binIndex < binEndIndex` as suggested in PR#113
* rfac: strip `recalculateBins` down to one algorithm that does not require `data` to be sorted and update tests
* rfac: update tests manifest
* rfac: don't sort the data in the initialiser
* bfix: fix code that took advantage of the data being sorted without actually being sure of that
* docs: Improve comments about workaround
* rfac: Create new test suite for performance testsrecalculateBins (#113)1 parent 6111313 commit 5d345e7
File tree
5 files changed
+90
-18
lines changed- Sources/SwiftPlot
- Tests/SwiftPlotTests
- PerformanceTests
5 files changed
+90
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
93 | | - | |
94 | | - | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
95 | 106 | | |
96 | | - | |
97 | | - | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
98 | 112 | | |
99 | 113 | | |
100 | 114 | | |
| |||
308 | 322 | | |
309 | 323 | | |
310 | 324 | | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
311 | 331 | | |
312 | 332 | | |
313 | 333 | | |
314 | 334 | | |
315 | | - | |
316 | | - | |
317 | | - | |
318 | | - | |
319 | | - | |
320 | | - | |
321 | | - | |
322 | | - | |
323 | | - | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
324 | 346 | | |
| 347 | + | |
325 | 348 | | |
326 | | - | |
327 | | - | |
| 349 | + | |
| 350 | + | |
328 | 351 | | |
| 352 | + | |
| 353 | + | |
329 | 354 | | |
330 | 355 | | |
331 | | - | |
| 356 | + | |
332 | 357 | | |
333 | 358 | | |
334 | 359 | | |
335 | 360 | | |
336 | 361 | | |
337 | 362 | | |
338 | 363 | | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
Lines changed: 22 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
21 | 20 | | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| 54 | + | |
54 | 55 | | |
55 | 56 | | |
56 | 57 | | |
| |||
85 | 86 | | |
86 | 87 | | |
87 | 88 | | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
88 | 98 | | |
89 | 99 | | |
90 | 100 | | |
| |||
110 | 120 | | |
111 | 121 | | |
112 | 122 | | |
| 123 | + | |
113 | 124 | | |
114 | 125 | | |
115 | 126 | | |
| |||
0 commit comments