Skip to content
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

Update bat's tab expansion preprocessor to use bat's ANSI escape sequence iterator. #2998

Merged
merged 3 commits into from
Jun 15, 2024

Conversation

eth-p
Copy link
Collaborator

@eth-p eth-p commented Jun 11, 2024

This pull request updates bat's tab expansion preprocessing function to use bat's vscreen::EscapeSequenceOffsetsIterator instead of console::AnsiCodeIterator.

Benchmarks

When running against a file with no tabs, there are no observable differences:

image

And when running against a file1 with 34443 tab characters, the difference is negligible:

image

However, it did trim a little over 16 KiB off the file size:

stat bat-master target/release/bat -c "%-20n %s"
# bat-master           5241880
# target/release/bat   5225368

Footnotes

  1. Command to create the file: file fd --glob '*.rs' --exec-batch sh -c 'cat "$@" > lots-of.rs' {} && sed -i "s/ /\t/g" lots-of.rs

@eth-p eth-p merged commit 10a1b24 into sharkdp:master Jun 15, 2024
23 checks passed
@eth-p eth-p deleted the improve-preprocessor branch June 15, 2024 23:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants