Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplify encode_to_slice by using chunks_exact_mut
Rather than using generate_iter to iterate over each 2-element chunks of output buffer, use chunks_exact_mut. This removes the need for the custom generate_iter function and makes the code shorter. Criterian shows improvement but to be honest I don’t trust those results (partially because also decoding showed improvements even though I didn’t touch it): hex_encode time: [79.268 µs 81.856 µs 84.279 µs] change: [-15.070% -12.678% -10.255%] (p = 0.00 < 0.05) Performance has improved. rustc_hex_encode time: [36.926 µs 36.949 µs 36.971 µs] change: [-3.3521% -3.2536% -3.1583%] (p = 0.00 < 0.05) Performance has improved. faster_hex_encode time: [820.07 ns 821.16 ns 822.52 ns] change: [-3.7706% -3.4712% -3.1944%] (p = 0.00 < 0.05) Performance has improved. faster_hex_encode_fallback time: [11.554 µs 11.557 µs 11.562 µs] change: [-2.8788% -2.8220% -2.7676%] (p = 0.00 < 0.05) Performance has improved. hex_decode time: [100.90 µs 100.98 µs 101.08 µs] change: [-3.9865% -3.5655% -3.2365%] (p = 0.00 < 0.05) Performance has improved. rustc_hex_decode time: [65.759 µs 65.788 µs 65.819 µs] change: [-2.1181% -1.9775% -1.8495%] (p = 0.00 < 0.05) Performance has improved. faster_hex_decode time: [2.2675 µs 2.2684 µs 2.2693 µs] change: [-2.9682% -2.8188% -2.6234%] (p = 0.00 < 0.05) Performance has improved. faster_hex_decode_unchecked time: [928.35 ns 929.18 ns 930.05 ns] change: [-0.5734% -0.4510% -0.3314%] (p = 0.00 < 0.05) Change within noise threshold. faster_hex_decode_fallback time: [11.416 µs 11.426 µs 11.438 µs] change: [-3.8020% -3.6669% -3.5267%] (p = 0.00 < 0.05) Performance has improved.
- Loading branch information