-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
improve performance of parse #28787
improve performance of parse #28787
Conversation
What were the numbers for 0.6, for comparison? |
Ideally this should really be necessary since the comparison operation between characters is just an integer comparison so it seems like something else is not quite right here if this is necessary for good performance. |
It is not the comparison that is expensive, it is the arithmetic ( However, hoisting the conversion like this still has a ~4% performance improvement so might as well leave it? |
0.6:
|
Parsers.jl hereby challenges you to a duel: julia> strings = [string(rand(UInt32)) for i in 1:10^4];
julia> f(strings) = for s in strings; Parsers.parse(s, Int) end;
julia> @btime f(strings)
549.167 μs (30000 allocations: 1.37 MiB) |
Well? |
Even though this comes with a small readability regression, I think it is worth it for such a basic function (we also show |
(cherry picked from commit 81850b6)
(cherry picked from commit 81850b6)
(cherry picked from commit 81850b6)
@quinnj Getting closer ;) julia> @btime f(strings)
595.071 μs (0 allocations: 0 bytes) |
(cherry picked from commit 81850b6)
Improves performance by preventing everything getting lifted to the Char domain.
Benchmark
Before
After
Still not completely caught up with 0.6 for
parseintperf
but getting close.