seq: Add a print_seq fast path function for integer and positive increments #7564
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.
A lot of custom logic, we basically do arithmetic on character arrays, but this comes at with huge performance gains.
Unlike coreutils
seq
, we do this for all positive increments (because why not), and we don't fall back to slow path if the last parameter is in scientific notation.Fixes #7482
I'm not too sure what I think about this ,-) This is a lot of added code, but this comes with huge performance gains, around 17x in some cases (and also, it was a fun puzzle, and I learnt quite a few new Rust things ,-P), and we are now competitive with GNU
seq
:We're less conservative than
GNU
, so this path also activates for ranges likes1 123 100000000
(the GNU manual says they do something special below 200 increment, but I suspect that value is lower) and1e11
, as long as the desired precision is still zero (a.k.a. integers).Still a draft, probably want to add something to
BENCHMARKING.md
, a few more tests, and see if I can extract a bit more performance...