Commit eac9958
authored
Optimize class_attribute_list/1 using an IO data tree (#4172)
Instead of producing intermediate flat lists and joining them via string concatenation using Enum.flat_map/2 and Enum.join/2, this recursive approach builds a deeply nested IO data tree. It evaluates ~1.5x faster and produces significantly less garbage collection pressure since intermediate strings for spaces and joined binaries are no longer allocated.1 parent ec0c23c commit eac9958
1 file changed
Lines changed: 11 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
176 | 176 | | |
177 | 177 | | |
178 | 178 | | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
188 | 187 | | |
189 | 188 | | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
190 | 192 | | |
191 | 193 | | |
192 | 194 | | |
| |||
0 commit comments