Commit 9619325
committed
Optimization of REXML::Document#add, #add_element
## Benchmark
```
$ benchmark-driver benchmark/parse_comment.yaml
before after before(YJIT) after(YJIT)
top_level 48.497k 54.645k 7.951k 8.288k i/s - 100.000 times in 0.002062s 0.001830s 0.012577s 0.012066s
in_doctype 48.615k 50.994k 7.930k 7.820k i/s - 100.000 times in 0.002057s 0.001961s 0.012611s 0.012787s
after_doctype 63.251k 64.061k 9.569k 9.434k i/s - 100.000 times in 0.001581s 0.001561s 0.010450s 0.010600s
many_comments 67.653 611.015 117.191 929.290 i/s - 100.000 times in 1.478125s 0.163662s 0.853309s 0.107609s
Comparison:
top_level
after: 54644.8 i/s
before: 48496.6 i/s - 1.13x slower
after(YJIT): 8287.7 i/s - 6.59x slower
before(YJIT): 7951.0 i/s - 6.87x slower
in_doctype
after: 50994.4 i/s
before: 48614.5 i/s - 1.05x slower
before(YJIT): 7929.6 i/s - 6.43x slower
after(YJIT): 7820.4 i/s - 6.52x slower
after_doctype
after: 64061.5 i/s
before: 63251.1 i/s - 1.01x slower
before(YJIT): 9569.4 i/s - 6.69x slower
after(YJIT): 9434.0 i/s - 6.79x slower
many_comments
after(YJIT): 929.3 i/s
after: 611.0 i/s - 1.52x slower
before(YJIT): 117.2 i/s - 7.93x slower
before: 67.7 i/s - 13.74x slower
```
- YJIT=ON : 0.98 - 7.93x faster
- YJIT=OFF : 1.01 - 9.02x faster1 parent 5248d63 commit 9619325
3 files changed
Lines changed: 51 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| 38 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
197 | 197 | | |
198 | 198 | | |
199 | 199 | | |
200 | | - | |
201 | | - | |
202 | | - | |
| 200 | + | |
| 201 | + | |
203 | 202 | | |
204 | 203 | | |
205 | 204 | | |
| |||
211 | 210 | | |
212 | 211 | | |
213 | 212 | | |
214 | | - | |
215 | | - | |
216 | | - | |
| 213 | + | |
| 214 | + | |
217 | 215 | | |
218 | 216 | | |
219 | 217 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
320 | 320 | | |
321 | 321 | | |
322 | 322 | | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
323 | 367 | | |
324 | 368 | | |
325 | 369 | | |
| |||
0 commit comments