Commit 4941f85
committed
Optimize list conversion to avoid temporary array allocation
Build Erlang lists directly using enif_make_list_cell instead of
allocating a temporary array and calling enif_make_list_from_array.
The optimization iterates the Python list in reverse and prepends
each element to build the list. This is O(1) per element and avoids
the overhead of allocating/freeing a temporary ERL_NIF_TERM array.1 parent 7d61857 commit 4941f85
1 file changed
Lines changed: 10 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
176 | | - | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
177 | 181 | | |
178 | 182 | | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
| 183 | + | |
| 184 | + | |
187 | 185 | | |
188 | | - | |
| 186 | + | |
| 187 | + | |
189 | 188 | | |
190 | | - | |
191 | | - | |
192 | | - | |
| 189 | + | |
193 | 190 | | |
194 | 191 | | |
195 | 192 | | |
| |||
0 commit comments