-
-
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
fix performance in printf #28670
fix performance in printf #28670
Conversation
9950b63
to
8eee6ed
Compare
8eee6ed
to
045a416
Compare
base/printf.jl
Outdated
@@ -862,8 +862,8 @@ function decode_oct(d::Integer) | |||
digits = DIGITSs[Threads.threadid()] | |||
@handle_zero x digits | |||
pt = i = div((sizeof(x)<<3)-leading_zeros(x)+2,3) | |||
while i > 0 | |||
digits[i] = '0'+(x&0x7) | |||
@inbounds while i > 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is always in bounds --- digits
is a fixed size and it seems to be possible to ask for enough digits to overflow it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok let's remove the inbounds.
045a416
to
4bd130b
Compare
(cherry picked from commit 4629a21)
(cherry picked from commit 4629a21)
(cherry picked from commit 4629a21)
(cherry picked from commit 4629a21)
(cherry picked from commit 4629a21)
Good to get the speed-up, while |
(cherry picked from commit 4629a21)
Same story as in #28661.
Improves the benchmark in
print_to_file
(that we show on the benchmark plot on the homepage).Before
After