Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@ghost
Copy link

@ghost ghost commented Nov 10, 2021

Here, the toint_1/2/4 calls require both less unsafe as well as being faster, since they're specialized to the exact width they need to parse.

I ran the benchmarks and got

Before:

parse_imf_fixdate       time:   [121.04 ns 121.10 ns 121.18 ns]
parse_rfc850_date       time:   [116.55 ns 116.67 ns 116.80 ns]
parse_asctime           time:   [112.93 ns 113.04 ns 113.19 ns]
encode_date             time:   [10.981 ns 10.994 ns 11.010 ns]

After:

parse_imf_fixdate       time:   [95.967 ns 96.094 ns 96.255 ns]
                        change: [-20.734% -20.645% -20.539%] (p = 0.00 < 0.05)
                        Performance has improved.

parse_rfc850_date       time:   [87.114 ns 87.320 ns 87.559 ns]
                        change: [-25.294% -25.142% -24.972%] (p = 0.00 < 0.05)
                        Performance has improved.

parse_asctime           time:   [100.90 ns 101.05 ns 101.24 ns]
                        change: [-10.600% -10.280% -9.9340%] (p = 0.00 < 0.05)
                        Performance has improved.

encode_date             time:   [10.990 ns 11.000 ns 11.011 ns]
                        change: [+0.0702% +0.2167% +0.4071%] (p = 0.01 < 0.05)
                        Change within noise threshold.

@ghost ghost marked this pull request as ready for review November 10, 2021 18:33
Copy link
Owner

@pyfisch pyfisch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Can you address the comments, fix the formatting and silence clippy? Then its good to go!

@pyfisch pyfisch merged commit 94d4895 into pyfisch:master Nov 17, 2021
@ghost ghost deleted the forbid-unsafe branch November 26, 2021 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant