Commit f9ac0d8
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 bfd8d93 commit f9ac0d8
1 file changed
Lines changed: 11 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
175 | 175 | | |
176 | 176 | | |
177 | 177 | | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
187 | 186 | | |
188 | 187 | | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
189 | 191 | | |
190 | 192 | | |
191 | 193 | | |
| |||
0 commit comments