-
-
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
Widen type signature of bytes2hex #39710
Conversation
The failures seem to be due to me messing up the copy & paste 🤦♂️ I've just noticed that |
8e4f108
to
1eb2042
Compare
Ok, I've pushed a reimplementation of julia> for i in [100, 1_000, 10_000, 100_000, 1_000_000, 10_000_000]
old[i] = @benchmarkable hex2bytes(str) setup=(str=randstring("0123456789abcdefABCDEF", $i)) evals=1
new[i] = @benchmarkable h2b(str) setup=(str=randstring("0123456789abcdefABCDEF", $i)) evals=1
end
julia> new_res, old_res = run(new), run(old); for f in (minimum, mean, median, maximum)
println("\n$f:"); display(judge(f(new_res), f(old_res)))
end
minimum:
6-element BenchmarkTools.BenchmarkGroup:
tags: []
10000 => TrialJudgement(-0.30% => invariant)
100000 => TrialJudgement(-0.99% => invariant)
1000000 => TrialJudgement(-0.63% => invariant)
10000000 => TrialJudgement(-0.39% => invariant)
1000 => TrialJudgement(+0.00% => invariant)
100 => TrialJudgement(+0.00% => invariant)
mean:
6-element BenchmarkTools.BenchmarkGroup:
tags: []
10000 => TrialJudgement(-0.60% => invariant)
100000 => TrialJudgement(-1.60% => invariant)
1000000 => TrialJudgement(-0.48% => invariant)
10000000 => TrialJudgement(-1.08% => invariant)
1000 => TrialJudgement(-1.04% => invariant)
100 => TrialJudgement(+0.18% => invariant)
median:
6-element BenchmarkTools.BenchmarkGroup:
tags: []
10000 => TrialJudgement(-0.14% => invariant)
100000 => TrialJudgement(-2.22% => invariant)
1000000 => TrialJudgement(-0.19% => invariant)
10000000 => TrialJudgement(-0.17% => invariant)
1000 => TrialJudgement(+0.00% => invariant)
100 => TrialJudgement(+0.00% => invariant)
maximum:
6-element BenchmarkTools.BenchmarkGroup:
tags: []
10000 => TrialJudgement(+3.41% => invariant)
100000 => TrialJudgement(+113.45% => regression)
1000000 => TrialJudgement(+5.30% => regression)
10000000 => TrialJudgement(-3.38% => invariant)
1000 => TrialJudgement(+82.57% => regression)
100 => TrialJudgement(+16.59% => regression)
The |
I tried getting rid of the branches in
I suppose we could create a lookup table for this - in any case, branch predictors are a truly marvellous thing. |
Unsure why |
It's the little gains in functions like this that multiply if called often enough. Plus I just enjoy figuring out what is fast and why! This function had been optimized a little in the past (Ref. #23267), which is why I want to make sure we don't leave any performance on the table here :) |
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.
#39710 (comment) is all I have to say about my concerns. I think this is a good improvement in terms of both generality and performance. 👍
Edit: It might be helpful to have !!! compat
notes in the docstrings.
Alright, thank you for the continued feedback! :) I'll add the |
Sorry, it's been a while! I think I've got everything now. Not 100% sure about the decision to remove |
If I read the CI log correctly, |
Can this be merged? |
bump? |
Force pushed for rebase & retriggering CI. |
Failure is in Distributed, string tests passed, so failure is unrelated to this PR. This has happened twice during the life of this PR now, is master not stable? Regardless, I've added a NEWS.md entry and from my POV this PR is otherwise done, so should be mergeable. |
Rerunning CI to see if this can be merged. Please ping if it passes and doesn't get merged. |
Seems to have failed in SuiteSparse. |
and make it slightly faster! Also improves error message on hex2bytes! when passing a non-ASCII string, And ADD compat notice, fix implementation to be more generic in regards to AbstractString.
and make it slightly faster! Also improves error message on hex2bytes! when passing a non-ASCII string, And ADD compat notice, fix implementation to be more generic in regards to AbstractString.
and make it slightly faster! Also improves error message on hex2bytes! when passing a non-ASCII string, And ADD compat notice, fix implementation to be more generic in regards to AbstractString.
Fixes #39284
This only implements the change required for iterators with HasLength().