Commit 92b238e
committed
Improve perf when building Ruby arrays from Rust
Applies Mat's suggestion from #169, essentially using RArray's
FromIterator implementation which appends to the RArray in batch instead
of `push`ing in a loop.
Before:
```
Call host func (4 args): 296182.4 i/s
Call host func (16 args): 239771.2 i/s - 1.24x slower
Call host func (64 args): 105414.9 i/s - 2.81x slower
Call host func (128 args): 44266.8 i/s - 6.69x slower
Call host func (256 args): 13739.3 i/s - 21.56x slower
```
After:
```
Call host func (4 args): 302802.0 i/s
Call host func (16 args): 250214.7 i/s - 1.21x slower
Call host func (64 args): 114372.2 i/s - 2.65x slower
Call host func (128 args): 47095.3 i/s - 6.43x slower
Call host func (256 args): 14555.6 i/s - 20.80x slower
```
Closes #1691 parent 668d461 commit 92b238e
1 file changed
Lines changed: 13 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
222 | 222 | | |
223 | 223 | | |
224 | 224 | | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
232 | 230 | | |
233 | 231 | | |
234 | 232 | | |
| |||
270 | 268 | | |
271 | 269 | | |
272 | 270 | | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
| 271 | + | |
| 272 | + | |
278 | 273 | | |
279 | | - | |
280 | | - | |
281 | | - | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
282 | 280 | | |
283 | 281 | | |
284 | 282 | | |
| |||
0 commit comments