rust-itertools / itertools

Extra iterator adaptors, iterator methods, free functions, and macros.
https://docs.rs/itertools/
Apache License 2.0
2.69k stars 303 forks source link

Specialize `PadUsing::[r]fold` #825

Closed Philippe-Cholet closed 8 months ago

Philippe-Cholet commented 8 months ago

Related to #755

cargo bench --bench specializations "pad_using/r?fold"

pad_using/fold          [1.2169 µs 1.2273 µs 1.2375 µs]
pad_using/fold          [679.64 ns 683.21 ns 687.65 ns]
                        [-45.562% -44.840% -44.185%]

pad_using/rfold         [1.3184 µs 1.3243 µs 1.3317 µs]
pad_using/rfold         [692.28 ns 694.11 ns 695.98 ns]
                        [-47.743% -47.421% -47.084%]