Commit fa11333
committed
Remove double allocations in Base.map by having to reverse the list
instead create it recursively in-order, via tail-recursion
Big perf improvement:
Before:
```julia
julia> @Btime DataStructures.map(x->x*2, $(list((1:1000)...)));
148.476 μs (6469 allocations: 163.55 KiB)
```
After:
```julia
julia> @Btime DataStructures.map(x->x*2, $(list((1:1000)...)));
29.705 μs (1745 allocations: 42.89 KiB)
```1 parent 214f3b3 commit fa11333
1 file changed
+2
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
| 73 | + | |
| 74 | + | |
79 | 75 | | |
80 | 76 | | |
81 | 77 | | |
| |||
0 commit comments