Add script to find slow-to-highlight files #913
Merged
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.
This PR adds a script that goes through all languages that are supported by 'bat'. For each language, it loops over the correspoinding file extensions and searches a given folder for matching files. It calls 'bat' for each of these files and measures the highlighting speed (number of characters per second). The script reports files which lead to slow highlighting speeds or errors during the execution of 'bat'.
Here are some results:
I found a couple of C#
*.cs
files. This was expected and will be fixed in the next release (see slow output, with pauses, with c# source code #677)I found a couple of
*.gemspec
and*.rake
files (Ruby) which lead to a panic. This is a minified example:Apparently, there is a problem with heredocs in the Ruby syntax: https://github.com/sublimehq/Packages/blob/f36b8f807d5f30d2b8ef639232a9fc5960f550fa/Ruby/Ruby.sublime-syntax#L4-L17
(note how GitHub also highlights this incorrectly)
Nevertheless, we obviously shouldn't panic here:
For some reason, this was not caught when creating the syntax binary dump where the regex should have been pretested. The offending regex is
^\1$
. Bug ticket: bat panics on Ruby files with unindented heredocs #914I found a
*.vue
file that leads to a panic:The minified example looks like this:
Bug ticket: bat panics on simple Vue file #915
I found a couple of files which are highlighted rather slowly, but nothing as drastic as the
Makefile
(Slow output with some Makefiles #750) and C# (slow output, with pauses, with c# source code #677) issues