Commit 637a3ca
committed
perf: optimize filter count()
Using the iterator_to_array entirely materializes the filtered result,
consuming unnecessary extra memory. Using a straight-forward foreach loop
will avoid the use of an iterator, avoiding duplicate storage and a
slightly faster execution.
Signed-off-by: Sacha Telgenhof <me@sachatelgenhof.com>1 parent 7fda9e6 commit 637a3ca
1 file changed
Lines changed: 10 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
| 33 | + | |
38 | 34 | | |
39 | | - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
40 | 44 | | |
41 | 45 | | |
0 commit comments