memchr
memchr copied to clipboard
Improve: Call target directly from unsafe_ifunc macro whenever possible.
Example based on discussion from:
- https://github.com/BurntSushi/memchr/issues/160
This is just an example of the sort of improvement/change I had in mind:
Before:
RUSTFLAGS="-C target-cpu=x86-64-v3" cargo bench
:
[create_string_pool_4000_V0] Packed size: 200343 bytes
unpack_string_pool_4000_V0
time: [27.400 µs 27.523 µs 27.663 µs]
change: [-2.8856% -2.2842% -1.6698%] (p = 0.00 < 0.05)
Performance has improved.
Found 9 outliers among 100 measurements (9.00%)
6 (6.00%) high mild
3 (3.00%) high severe
After, with no_std
:
[create_string_pool_4000_V0] Packed size: 200343 bytes
unpack_string_pool_4000_V0
time: [26.712 µs 26.769 µs 26.847 µs]
change: [-2.3623% -2.1856% -1.9750%] (p = 0.00 < 0.05)
Performance has improved.
Test is more than just use of memchr; it's on a real scenario involving memchr. So this isn't a '2%' improvement, raw improvement is closer to '4%'.
For more details see:
- https://github.com/BurntSushi/memchr/issues/160#issuecomment-2402684620