Commit 3c6d699
authored
Optimize keyed_to_iodata by extracting to_iodata_parts to avoid Map.put (#4198)
Extracts `to_iodata_parts/5` from `to_iodata/4` to bypass an unnecessary
`Map.put(diff, @static, static)` allocation on every iteration of a
comprehension.
Benchmarks show a ~1.7x speedup for converting comprehensions into iodata
(1833ms -> 1074ms for 100k iterations of a 100-item comprehension).1 parent 3179652 commit 3c6d699
1 file changed
+7
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
71 | | - | |
| 70 | + | |
72 | 71 | | |
73 | 72 | | |
74 | 73 | | |
| |||
82 | 81 | | |
83 | 82 | | |
84 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
85 | 89 | | |
86 | 90 | | |
87 | 91 | | |
88 | | - | |
| 92 | + | |
89 | 93 | | |
90 | 94 | | |
91 | 95 | | |
| |||
0 commit comments