New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fastfloat: support elided integer or float part #84
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
One of the integer part or the fractional part may be elided; one of the decimal point or the exponent part may be elided. According to https://go.dev/ref/spec#Floating-point_literals Relevant issue: VictoriaMetrics/VictoriaMetrics#3544 benchstat: ``` benchstat old.txt new.txt name old time/op new time/op delta ParseUint64/0/std-10 0.50ns ± 0% 0.52ns ± 1% ~ (p=0.100 n=3+3) ParseUint64/0/custom-10 0.31ns ± 0% 0.33ns ± 3% ~ (p=0.100 n=3+3) ParseUint64/12/std-10 0.70ns ± 0% 0.71ns ± 0% ~ (p=0.100 n=3+3) ParseUint64/12/custom-10 0.47ns ± 1% 0.47ns ± 1% ~ (p=0.100 n=3+3) ParseUint64/12345/std-10 1.05ns ± 1% 1.07ns ± 0% ~ (p=0.100 n=3+3) ParseUint64/12345/custom-10 0.84ns ± 0% 0.86ns ± 1% ~ (p=0.100 n=3+3) ParseUint64/1234567890/std-10 1.66ns ± 1% 1.68ns ± 0% ~ (p=0.600 n=3+3) ParseUint64/1234567890/custom-10 1.24ns ± 0% 1.26ns ± 1% ~ (p=0.200 n=3+3) ParseUint64/9223372036854775807/std-10 2.87ns ± 0% 2.87ns ± 0% ~ (p=1.000 n=3+3) ParseUint64/9223372036854775807/custom-10 4.67ns ± 0% 4.68ns ± 0% ~ (p=0.700 n=3+3) ParseUint64BestEffort/0/std-10 0.51ns ± 1% 0.51ns ± 1% ~ (p=1.000 n=3+3) ParseUint64BestEffort/0/custom-10 0.31ns ± 1% 0.31ns ± 1% ~ (p=1.000 n=3+3) ParseUint64BestEffort/12/std-10 0.69ns ± 0% 0.70ns ± 1% ~ (p=0.700 n=3+3) ParseUint64BestEffort/12/custom-10 0.46ns ± 0% 0.46ns ± 0% ~ (p=0.100 n=3+3) ParseUint64BestEffort/12345/std-10 1.05ns ± 0% 1.06ns ± 1% ~ (p=0.200 n=3+3) ParseUint64BestEffort/12345/custom-10 0.84ns ± 1% 0.84ns ± 0% ~ (p=1.000 n=3+3) ParseUint64BestEffort/1234567890/std-10 1.65ns ± 0% 1.66ns ± 0% ~ (p=0.700 n=3+3) ParseUint64BestEffort/1234567890/custom-10 1.25ns ± 2% 1.24ns ± 0% ~ (p=1.000 n=3+3) ParseUint64BestEffort/9223372036854775807/std-10 2.88ns ± 0% 2.88ns ± 0% ~ (p=0.300 n=3+3) ParseUint64BestEffort/9223372036854775807/custom-10 4.66ns ± 1% 4.66ns ± 0% ~ (p=0.700 n=3+3) ParseInt64/0/std-10 0.81ns ± 0% 0.79ns ± 2% ~ (p=0.100 n=3+3) ParseInt64/0/custom-10 0.35ns ± 0% 0.35ns ± 0% ~ (p=0.800 n=3+3) ParseInt64/12/std-10 1.01ns ± 0% 0.97ns ± 0% ~ (p=0.100 n=3+3) ParseInt64/12/custom-10 0.51ns ± 0% 0.51ns ± 0% ~ (p=0.600 n=3+3) ParseInt64/12345/std-10 1.37ns ± 1% 1.32ns ± 0% ~ (p=0.100 n=3+3) ParseInt64/12345/custom-10 0.90ns ± 2% 0.89ns ± 0% ~ (p=0.700 n=3+3) ParseInt64/1234567890/std-10 1.94ns ± 0% 1.95ns ± 0% ~ (p=0.200 n=3+3) ParseInt64/1234567890/custom-10 1.28ns ± 0% 1.28ns ± 0% ~ (p=1.000 n=3+3) ParseInt64/9223372036854775807/std-10 3.18ns ± 0% 3.18ns ± 0% ~ (p=1.000 n=3+3) ParseInt64/9223372036854775807/custom-10 4.84ns ± 0% 4.86ns ± 1% ~ (p=0.200 n=3+3) ParseInt64BestEffort/0/std-10 0.78ns ± 0% 0.78ns ± 0% ~ (p=0.700 n=3+3) ParseInt64BestEffort/0/custom-10 0.35ns ± 0% 0.35ns ± 2% ~ (p=0.400 n=3+3) ParseInt64BestEffort/12/std-10 0.97ns ± 0% 0.97ns ± 0% ~ (p=0.100 n=3+3) ParseInt64BestEffort/12/custom-10 0.51ns ± 2% 0.50ns ± 0% ~ (p=0.200 n=3+3) ParseInt64BestEffort/12345/std-10 1.33ns ± 0% 1.33ns ± 1% ~ (p=0.600 n=3+3) ParseInt64BestEffort/12345/custom-10 0.88ns ± 1% 0.89ns ± 0% ~ (p=0.200 n=3+3) ParseInt64BestEffort/1234567890/std-10 1.96ns ± 1% 1.95ns ± 0% ~ (p=0.400 n=3+3) ParseInt64BestEffort/1234567890/custom-10 1.27ns ± 1% 1.27ns ± 1% ~ (p=1.000 n=3+3) ParseInt64BestEffort/9223372036854775807/std-10 3.18ns ± 0% 3.20ns ± 1% ~ (p=0.200 n=3+3) ParseInt64BestEffort/9223372036854775807/custom-10 4.93ns ± 1% 4.92ns ± 0% ~ (p=0.800 n=3+3) ParseBestEffort/0/std-10 1.42ns ± 1% 1.41ns ± 1% ~ (p=0.400 n=3+3) ParseBestEffort/0/custom-10 0.42ns ± 0% 0.43ns ± 1% ~ (p=0.400 n=3+3) ParseBestEffort/12/std-10 1.76ns ± 1% 1.75ns ± 0% ~ (p=0.100 n=3+3) ParseBestEffort/12/custom-10 0.54ns ± 0% 0.55ns ± 1% ~ (p=0.200 n=3+3) ParseBestEffort/12345/std-10 2.35ns ± 1% 2.34ns ± 0% ~ (p=1.000 n=3+3) ParseBestEffort/12345/custom-10 0.91ns ± 0% 0.70ns ± 0% ~ (p=0.100 n=3+3) ParseBestEffort/1234567890/std-10 3.38ns ± 1% 3.38ns ± 0% ~ (p=1.000 n=3+3) ParseBestEffort/1234567890/custom-10 1.32ns ± 2% 1.09ns ± 0% ~ (p=0.100 n=3+3) ParseBestEffort/1234.45678/std-10 3.27ns ± 1% 3.29ns ± 1% ~ (p=0.800 n=3+3) ParseBestEffort/1234.45678/custom-10 1.56ns ± 2% 1.30ns ± 0% ~ (p=0.100 n=3+3) ParseBestEffort/1234e45/std-10 2.83ns ± 1% 2.82ns ± 0% ~ (p=1.000 n=3+3) ParseBestEffort/1234e45/custom-10 1.31ns ± 2% 1.06ns ± 1% ~ (p=0.100 n=3+3) ParseBestEffort/12.34e-34/std-10 2.97ns ± 0% 2.97ns ± 0% ~ (p=0.700 n=3+3) ParseBestEffort/12.34e-34/custom-10 1.33ns ± 0% 1.28ns ± 0% ~ (p=0.100 n=3+3) ParseBestEffort/12345.1234567890/std-10 4.48ns ± 0% 4.53ns ± 0% ~ (p=0.100 n=3+3) ParseBestEffort/12345.1234567890/custom-10 2.03ns ± 0% 1.76ns ± 1% ~ (p=0.100 n=3+3) ParseBestEffort/12345.12345678901/std-10 4.68ns ± 0% 4.70ns ± 0% ~ (p=0.400 n=3+3) ParseBestEffort/12345.12345678901/custom-10 6.46ns ± 1% 6.14ns ± 0% ~ (p=0.100 n=3+3) Parse/0/std-10 1.41ns ± 0% 1.43ns ± 1% ~ (p=0.200 n=3+3) Parse/0/custom-10 0.42ns ± 0% 0.46ns ± 1% ~ (p=0.100 n=3+3) Parse/12/std-10 1.75ns ± 0% 1.77ns ± 2% ~ (p=0.800 n=3+3) Parse/12/custom-10 0.51ns ± 1% 0.61ns ± 0% ~ (p=0.100 n=3+3) Parse/12345/std-10 2.34ns ± 0% 2.34ns ± 0% ~ (p=1.000 n=3+3) Parse/12345/custom-10 0.67ns ± 0% 0.99ns ± 0% ~ (p=0.100 n=3+3) Parse/1234567890/std-10 3.44ns ± 4% 3.39ns ± 0% ~ (p=1.000 n=3+3) Parse/1234567890/custom-10 1.07ns ± 1% 1.38ns ± 0% ~ (p=0.100 n=3+3) Parse/1234.45678/std-10 3.29ns ± 2% 3.27ns ± 0% ~ (p=1.000 n=3+3) Parse/1234.45678/custom-10 1.26ns ± 0% 1.58ns ± 0% ~ (p=0.100 n=3+3) Parse/1234e45/std-10 2.82ns ± 0% 2.83ns ± 0% ~ (p=0.100 n=3+3) Parse/1234e45/custom-10 1.06ns ± 0% 1.39ns ± 1% ~ (p=0.100 n=3+3) Parse/12.34e-34/std-10 2.98ns ± 0% 2.99ns ± 0% ~ (p=0.400 n=3+3) Parse/12.34e-34/custom-10 1.29ns ± 0% 1.37ns ± 0% ~ (p=0.100 n=3+3) Parse/12345.1234567890/std-10 4.64ns ± 4% 4.50ns ± 1% ~ (p=0.200 n=3+3) Parse/12345.1234567890/custom-10 1.79ns ± 2% 2.06ns ± 0% ~ (p=0.100 n=3+3) Parse/12345.12345678901/std-10 4.71ns ± 1% 4.70ns ± 1% ~ (p=0.700 n=3+3) Parse/12345.12345678901/custom-10 6.22ns ± 1% 6.47ns ± 1% ~ (p=0.100 n=3+3) name old speed new speed delta ParseUint64/0/std-10 1.99GB/s ± 0% 1.93GB/s ± 1% ~ (p=0.100 n=3+3) ParseUint64/0/custom-10 3.18GB/s ± 0% 3.06GB/s ± 3% ~ (p=0.100 n=3+3) ParseUint64/12/std-10 2.87GB/s ± 0% 2.82GB/s ± 0% ~ (p=0.100 n=3+3) ParseUint64/12/custom-10 4.30GB/s ± 1% 4.22GB/s ± 1% ~ (p=0.100 n=3+3) ParseUint64/12345/std-10 4.76GB/s ± 1% 4.67GB/s ± 0% ~ (p=0.100 n=3+3) ParseUint64/12345/custom-10 5.94GB/s ± 0% 5.78GB/s ± 1% ~ (p=0.100 n=3+3) ParseUint64/1234567890/std-10 6.02GB/s ± 1% 5.94GB/s ± 0% ~ (p=0.700 n=3+3) ParseUint64/1234567890/custom-10 8.06GB/s ± 0% 7.96GB/s ± 1% ~ (p=0.200 n=3+3) ParseUint64/9223372036854775807/std-10 6.61GB/s ± 0% 6.61GB/s ± 0% ~ (p=1.000 n=3+3) ParseUint64/9223372036854775807/custom-10 4.07GB/s ± 0% 4.06GB/s ± 0% ~ (p=0.700 n=3+3) ParseUint64BestEffort/0/std-10 1.98GB/s ± 1% 1.98GB/s ± 1% ~ (p=1.000 n=3+3) ParseUint64BestEffort/0/custom-10 3.18GB/s ± 1% 3.18GB/s ± 1% ~ (p=1.000 n=3+3) ParseUint64BestEffort/12/std-10 2.88GB/s ± 0% 2.87GB/s ± 1% ~ (p=0.700 n=3+3) ParseUint64BestEffort/12/custom-10 4.35GB/s ± 0% 4.34GB/s ± 0% ~ (p=0.100 n=3+3) ParseUint64BestEffort/12345/std-10 4.78GB/s ± 0% 4.71GB/s ± 1% ~ (p=0.100 n=3+3) ParseUint64BestEffort/12345/custom-10 5.96GB/s ± 1% 5.96GB/s ± 0% ~ (p=1.000 n=3+3) ParseUint64BestEffort/1234567890/std-10 6.06GB/s ± 0% 6.04GB/s ± 0% ~ (p=0.700 n=3+3) ParseUint64BestEffort/1234567890/custom-10 8.02GB/s ± 2% 8.07GB/s ± 0% ~ (p=1.000 n=3+3) ParseUint64BestEffort/9223372036854775807/std-10 6.60GB/s ± 0% 6.59GB/s ± 0% ~ (p=0.200 n=3+3) ParseUint64BestEffort/9223372036854775807/custom-10 4.07GB/s ± 1% 4.08GB/s ± 0% ~ (p=0.700 n=3+3) ParseInt64/0/std-10 1.23GB/s ± 0% 1.26GB/s ± 2% ~ (p=0.100 n=3+3) ParseInt64/0/custom-10 2.84GB/s ± 0% 2.84GB/s ± 0% ~ (p=0.700 n=3+3) ParseInt64/12/std-10 1.98GB/s ± 0% 2.07GB/s ± 0% ~ (p=0.100 n=3+3) ParseInt64/12/custom-10 3.93GB/s ± 0% 3.93GB/s ± 0% ~ (p=0.700 n=3+3) ParseInt64/12345/std-10 3.66GB/s ± 1% 3.78GB/s ± 0% ~ (p=0.100 n=3+3) ParseInt64/12345/custom-10 5.54GB/s ± 2% 5.62GB/s ± 0% ~ (p=0.700 n=3+3) ParseInt64/1234567890/std-10 5.15GB/s ± 0% 5.13GB/s ± 0% ~ (p=0.200 n=3+3) ParseInt64/1234567890/custom-10 7.81GB/s ± 0% 7.82GB/s ± 0% ~ (p=0.700 n=3+3) ParseInt64/9223372036854775807/std-10 5.98GB/s ± 0% 5.98GB/s ± 0% ~ (p=1.000 n=3+3) ParseInt64/9223372036854775807/custom-10 3.93GB/s ± 0% 3.91GB/s ± 1% ~ (p=0.200 n=3+3) ParseInt64BestEffort/0/std-10 1.29GB/s ± 0% 1.28GB/s ± 0% ~ (p=0.700 n=3+3) ParseInt64BestEffort/0/custom-10 2.86GB/s ± 0% 2.83GB/s ± 2% ~ (p=0.400 n=3+3) ParseInt64BestEffort/12/std-10 2.07GB/s ± 0% 2.06GB/s ± 0% ~ (p=0.100 n=3+3) ParseInt64BestEffort/12/custom-10 3.94GB/s ± 2% 4.00GB/s ± 0% ~ (p=0.200 n=3+3) ParseInt64BestEffort/12345/std-10 3.77GB/s ± 0% 3.77GB/s ± 1% ~ (p=0.700 n=3+3) ParseInt64BestEffort/12345/custom-10 5.68GB/s ± 1% 5.65GB/s ± 0% ~ (p=0.200 n=3+3) ParseInt64BestEffort/1234567890/std-10 5.11GB/s ± 1% 5.14GB/s ± 0% ~ (p=0.400 n=3+3) ParseInt64BestEffort/1234567890/custom-10 7.86GB/s ± 1% 7.85GB/s ± 1% ~ (p=1.000 n=3+3) ParseInt64BestEffort/9223372036854775807/std-10 5.98GB/s ± 0% 5.94GB/s ± 1% ~ (p=0.100 n=3+3) ParseInt64BestEffort/9223372036854775807/custom-10 3.85GB/s ± 1% 3.87GB/s ± 0% ~ (p=1.000 n=3+3) ParseBestEffort/0/std-10 705MB/s ± 1% 709MB/s ± 1% ~ (p=0.400 n=3+3) ParseBestEffort/0/custom-10 2.37GB/s ± 0% 2.35GB/s ± 1% ~ (p=0.400 n=3+3) ParseBestEffort/12/std-10 1.13GB/s ± 1% 1.14GB/s ± 0% ~ (p=0.100 n=3+3) ParseBestEffort/12/custom-10 3.71GB/s ± 0% 3.67GB/s ± 1% ~ (p=0.200 n=3+3) ParseBestEffort/12345/std-10 2.13GB/s ± 1% 2.13GB/s ± 0% ~ (p=1.000 n=3+3) ParseBestEffort/12345/custom-10 5.50GB/s ± 0% 7.10GB/s ± 0% ~ (p=0.100 n=3+3) ParseBestEffort/1234567890/std-10 2.96GB/s ± 0% 2.96GB/s ± 0% ~ (p=1.000 n=3+3) ParseBestEffort/1234567890/custom-10 7.56GB/s ± 2% 9.14GB/s ± 0% ~ (p=0.100 n=3+3) ParseBestEffort/1234.45678/std-10 3.06GB/s ± 1% 3.04GB/s ± 1% ~ (p=0.700 n=3+3) ParseBestEffort/1234.45678/custom-10 6.41GB/s ± 2% 7.71GB/s ± 0% ~ (p=0.100 n=3+3) ParseBestEffort/1234e45/std-10 2.48GB/s ± 1% 2.48GB/s ± 0% ~ (p=1.000 n=3+3) ParseBestEffort/1234e45/custom-10 5.33GB/s ± 2% 6.59GB/s ± 1% ~ (p=0.100 n=3+3) ParseBestEffort/12.34e-34/std-10 3.03GB/s ± 0% 3.03GB/s ± 0% ~ (p=0.700 n=3+3) ParseBestEffort/12.34e-34/custom-10 6.75GB/s ± 0% 7.04GB/s ± 0% ~ (p=0.100 n=3+3) ParseBestEffort/12345.1234567890/std-10 3.57GB/s ± 0% 3.54GB/s ± 0% ~ (p=0.100 n=3+3) ParseBestEffort/12345.1234567890/custom-10 7.89GB/s ± 0% 9.07GB/s ± 1% ~ (p=0.100 n=3+3) ParseBestEffort/12345.12345678901/std-10 3.63GB/s ± 0% 3.61GB/s ± 0% ~ (p=0.400 n=3+3) ParseBestEffort/12345.12345678901/custom-10 2.63GB/s ± 1% 2.77GB/s ± 0% ~ (p=0.100 n=3+3) Parse/0/std-10 709MB/s ± 0% 700MB/s ± 1% ~ (p=0.200 n=3+3) Parse/0/custom-10 2.36GB/s ± 0% 2.17GB/s ± 1% ~ (p=0.100 n=3+3) Parse/12/std-10 1.14GB/s ± 0% 1.13GB/s ± 2% ~ (p=1.000 n=3+3) Parse/12/custom-10 3.95GB/s ± 1% 3.26GB/s ± 0% ~ (p=0.100 n=3+3) Parse/12345/std-10 2.13GB/s ± 0% 2.14GB/s ± 0% ~ (p=1.000 n=3+3) Parse/12345/custom-10 7.47GB/s ± 0% 5.04GB/s ± 0% ~ (p=0.100 n=3+3) Parse/1234567890/std-10 2.91GB/s ± 4% 2.95GB/s ± 0% ~ (p=1.000 n=3+3) Parse/1234567890/custom-10 9.36GB/s ± 1% 7.25GB/s ± 0% ~ (p=0.100 n=3+3) Parse/1234.45678/std-10 3.04GB/s ± 2% 3.06GB/s ± 0% ~ (p=1.000 n=3+3) Parse/1234.45678/custom-10 7.95GB/s ± 0% 6.31GB/s ± 0% ~ (p=0.100 n=3+3) Parse/1234e45/std-10 2.48GB/s ± 0% 2.47GB/s ± 0% ~ (p=0.100 n=3+3) Parse/1234e45/custom-10 6.63GB/s ± 0% 5.04GB/s ± 1% ~ (p=0.100 n=3+3) Parse/12.34e-34/std-10 3.02GB/s ± 0% 3.01GB/s ± 0% ~ (p=0.400 n=3+3) Parse/12.34e-34/custom-10 6.99GB/s ± 0% 6.59GB/s ± 0% ~ (p=0.100 n=3+3) Parse/12345.1234567890/std-10 3.45GB/s ± 4% 3.55GB/s ± 1% ~ (p=0.200 n=3+3) Parse/12345.1234567890/custom-10 8.95GB/s ± 2% 7.77GB/s ± 0% ~ (p=0.100 n=3+3) Parse/12345.12345678901/std-10 3.61GB/s ± 1% 3.62GB/s ± 1% ~ (p=0.700 n=3+3) Parse/12345.12345678901/custom-10 2.74GB/s ± 1% 2.63GB/s ± 1% ~ (p=0.100 n=3+3) ```
valyala
approved these changes
Dec 29, 2022
Thanks! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
One of the integer part or the fractional part may be elided;
one of the decimal point or the exponent part may be elided.
According to https://go.dev/ref/spec#Floating-point_literals
Relevant issue:
VictoriaMetrics/VictoriaMetrics#3544
benchstat: