-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
bat slow when doing a git lg and using it as the pager compared to less #1147
Comments
Thank you for reporting this. I can confirm this by running
in the What you are asking If you use |
line numbers and coloring in general. Basically just want to replace |
I looked into this for a bit. Using Further, we can use
If we use A lot of time is actually spent in the terminal emulator that renders the output. We can see this by running
which actually outputs the same content, but does not display it on the screen. FYI @eth-p |
That's a lot of overhead, wow. What if we keep a preallocated buffer for printing individual lines? Avoid the syscall and alloc overhead until the very end when the output line is generated. |
Was thinking about that too. Somehow I would have hoped that a |
What would happen if we just replace write with fwrite? won't that do buffering? So it would be less expensive? The only thing is we would likely need a way of flushing after X milliseconds. |
Any progress? |
Some ideas about the way forward was outlined at #1481 (comment) |
I wanted to revisit this issue and see if things have improved as a result of #2544. I created a test file by using your command, There's still a lot of room for improvement, but it's something. One area that I'm hoping to work on is reducing the redundant color codes emitted by |
What version of
bat
are you using?bat 0.15.4
Describe the bug you encountered:
When using
bat
as the core pagergit config --global core.pager bat
and using it withgit lg
usinggit config --global alias.lg=log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
The performance of
git lg
on a long history is noticeablely slower compared to that of less. This happens in both CMD and Windows Terminal. Though it is more noticeable in WindowsDescribe what you expected to happen?
Performance should be comparable to less, maybe about 10% slower, but you can see it rendering.
How did you install
bat
?scoop
[paste the output of
info.sh
here]Microsoft Windows [Version 10.0.19041.450]
The text was updated successfully, but these errors were encountered: