-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
seq: Performance optimization #9557
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
base: main
Are you sure you want to change the base?
Conversation
|
GNU testsuite comparison: |
|
Would be great to add your example to the benchmarks |
In a separate pr please :) |
anastygnome
left a comment
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.
Any reason for not using
n.checked_ilog10().unwrap_or(0) + 1Which should be available?
Seemed unnecessary given it is just a constant. If there is any benefit to this alternative I am happy to refactor. |
88d12d3 to
f026b7a
Compare
CodSpeed Performance ReportMerging #9557 will improve performances by 58.87%Comparing Summary
Benchmarks breakdown
Footnotes
|
|
any idea why tsort_input_parsing_heavy regressed ? |
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
If I recall correctly the performance is similar to your solution and it's part of the language. Could you try sending a commit to trigger the benchmarks with this solution instead? |
|
note, upstream fails this way - what do you think we should do here? |
|
After some digging, the maximum value |
Reading #6182 I noticed that most of the time spent running
cargo run seq 4e4000003 4e4000003was just BigUint::to_string()Reading the code I found it is being called twice, once to get the actual string representation of the first number, and again on the last number, but only to get its length; and discarding the actual result.
This seems fine on fairly small numbers, but its efficiency degrades significantly on larger ones.
In my machine, this change resulted in a ~2x speedup on the mentioned case, and a marginal but seemingly better performance on smaller cases.