Something strange is going on. On a 1500-line .cs file, bat takes ~7s to list the file. --pager none, both with and without -p (not much difference with -p). I can see a pause after every1-2 dozen lines are output. --colors never also doesn't make a difference (bench via hyperfine):
| Command |
Mean [ms] |
Min [ms] |
Max [ms] |
Relative |
cmd /c type EntityComponentStore.cs |
86.1 ± 7.3 |
75.9 |
101.1 |
1.0 |
bat --pager none EntityComponentStore.cs |
7734.8 ± 586.6 |
6857.4 |
8700.1 |
89.9 |
bat --pager none -p EntityComponentStore.cs |
6982.9 ± 464.3 |
6290.5 |
7889.4 |
81.1 |
bat --color never --pager none EntityComponentStore.cs |
7155.5 ± 460.3 |
6586.1 |
7804.1 |
83.1 |
bat --color never --pager none -p EntityComponentStore.cs |
7053.2 ± 492.3 |
6409.1 |
8076.1 |
82.0 |
bat 0.12.1, msvc build on Windows, in a regular cmd.exe console window.
I'd expect some slowdown but it seems like something buggy is happening. If I do the same on a cpp file, also ~1500 lines:
| Command |
Mean [ms] |
Min [ms] |
Max [ms] |
Relative |
cmd /c type ApiDispatchers.cpp |
98.4 ± 10.0 |
83.6 |
115.9 |
1.0 |
bat --pager none ApiDispatchers.cpp |
768.5 ± 88.2 |
677.9 |
995.4 |
7.8 |
bat --pager none -p ApiDispatchers.cpp |
683.8 ± 128.9 |
549.4 |
959.0 |
6.9 |
bat --color never --pager none ApiDispatchers.cpp |
480.1 ± 46.7 |
440.2 |
584.2 |
4.9 |
bat --color never --pager none -p ApiDispatchers.cpp |
447.6 ± 42.5 |
414.6 |
542.0 |
4.5 |
Which is much more in line with what I'd expect. Is there something different about how the syntax highlighting for C# is handled? Is it all regexp or something else expensive based?
Something strange is going on. On a 1500-line .cs file, bat takes ~7s to list the file.
--pager none, both with and without-p(not much difference with -p). I can see a pause after every1-2 dozen lines are output.--colors neveralso doesn't make a difference (bench viahyperfine):cmd /c type EntityComponentStore.csbat --pager none EntityComponentStore.csbat --pager none -p EntityComponentStore.csbat --color never --pager none EntityComponentStore.csbat --color never --pager none -p EntityComponentStore.csbat 0.12.1, msvc build on Windows, in a regular cmd.exe console window.
I'd expect some slowdown but it seems like something buggy is happening. If I do the same on a cpp file, also ~1500 lines:
cmd /c type ApiDispatchers.cppbat --pager none ApiDispatchers.cppbat --pager none -p ApiDispatchers.cppbat --color never --pager none ApiDispatchers.cppbat --color never --pager none -p ApiDispatchers.cppWhich is much more in line with what I'd expect. Is there something different about how the syntax highlighting for C# is handled? Is it all regexp or something else expensive based?