Commit 7cb478f
committed
Optimize LEB128 data reading
As it turns out, the Rust compiler uses variable length LEB128 encoded
integers internally. It so happens that they spent a fair amount of
effort micro-optimizing the decoding functionality [0] [1], as it's in
the hot path.
With this change we replace our decoding routines with these optimized
ones. To make that happen more easily (and to gain some base line speed
up), also remove the "shift" return from the respective methods. As a
result of these changes, we see a respective speed up:
Before:
test util::tests::bench_u64_leb128_reading ... bench: 128 ns/iter (+/- 10)
After:
test util::tests::bench_u64_leb128_reading ... bench: 103 ns/iter (+/- 5)
Gsym decoding, which uses these routines, improved as follows:
main/symbolize_gsym_multi_no_setup
time: [146.26 µs 146.69 µs 147.18 µs]
change: [−7.2075% −5.7106% −4.4870%] (p = 0.00 < 0.02)
Performance has improved.
[0] rust-lang/rust#69050
[1] rust-lang/rust#69157
Signed-off-by: Daniel Müller <deso@posteo.net>1 parent 228ead0 commit 7cb478f
3 files changed
Lines changed: 69 additions & 46 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
29 | | - | |
| 28 | + | |
30 | 29 | | |
31 | 30 | | |
32 | 31 | | |
| |||
41 | 40 | | |
42 | 41 | | |
43 | 42 | | |
44 | | - | |
45 | | - | |
| 43 | + | |
46 | 44 | | |
47 | 45 | | |
48 | | - | |
49 | | - | |
| 46 | + | |
50 | 47 | | |
51 | 48 | | |
52 | 49 | | |
| |||
91 | 88 | | |
92 | 89 | | |
93 | 90 | | |
94 | | - | |
95 | | - | |
| 91 | + | |
96 | 92 | | |
97 | 93 | | |
98 | 94 | | |
99 | 95 | | |
100 | 96 | | |
101 | | - | |
102 | | - | |
| 97 | + | |
103 | 98 | | |
104 | 99 | | |
105 | 100 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
52 | | - | |
53 | | - | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
111 | | - | |
| 111 | + | |
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
116 | | - | |
| 116 | + | |
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
121 | | - | |
| 121 | + | |
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
387 | 387 | | |
388 | 388 | | |
389 | 389 | | |
| 390 | + | |
| 391 | + | |
390 | 392 | | |
391 | 393 | | |
392 | 394 | | |
| |||
470 | 472 | | |
471 | 473 | | |
472 | 474 | | |
473 | | - | |
474 | | - | |
475 | | - | |
476 | | - | |
477 | | - | |
478 | | - | |
479 | | - | |
480 | | - | |
481 | | - | |
482 | | - | |
483 | | - | |
484 | | - | |
485 | | - | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
486 | 494 | | |
487 | | - | |
| 495 | + | |
488 | 496 | | |
| 497 | + | |
489 | 498 | | |
490 | | - | |
491 | 499 | | |
492 | 500 | | |
493 | 501 | | |
494 | 502 | | |
495 | | - | |
496 | | - | |
497 | | - | |
498 | | - | |
499 | | - | |
500 | | - | |
501 | | - | |
502 | | - | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
503 | 524 | | |
504 | 525 | | |
505 | 526 | | |
| |||
527 | 548 | | |
528 | 549 | | |
529 | 550 | | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
530 | 561 | | |
531 | 562 | | |
532 | 563 | | |
| |||
815 | 846 | | |
816 | 847 | | |
817 | 848 | | |
818 | | - | |
| 849 | + | |
819 | 850 | | |
820 | | - | |
821 | 851 | | |
822 | | - | |
| 852 | + | |
823 | 853 | | |
824 | | - | |
825 | 854 | | |
826 | 855 | | |
827 | 856 | | |
| |||
941 | 970 | | |
942 | 971 | | |
943 | 972 | | |
944 | | - | |
| 973 | + | |
945 | 974 | | |
946 | 975 | | |
947 | 976 | | |
948 | 977 | | |
949 | 978 | | |
950 | 979 | | |
951 | | - | |
| 980 | + | |
952 | 981 | | |
953 | | - | |
954 | 982 | | |
955 | 983 | | |
956 | 984 | | |
| |||
0 commit comments