5 ms·
One application this could work really well for is syntax highlighting. Textmate/Sublime syntax files are basically lists of hundreds of regexes that have to be
by trishume 11y ago
One application this could work really well for is syntax highlighting. Textmate/Sublime syntax files are basically lists of hundreds of regexes that have to be matched very quickly over the same content.
With this library it might be possible for an open source editor beat Sublime text at highlighting using the same grammars. Which is saying something since Sublime is crazy fast and the highlighter is even parallelized.
- finnh 11y agoeven if Sublime doesn't need it ... vim sure does!
- glangdale 11y agoHyperscan is likely a bit heavyweight for this application. Anything that only needs to keep up with user input for a small number of patterns would probably be better off with a lightweight solution with wider pattern support. Although we would be interested in seeing the integration...
- varunramesh 11y agoAtom needs something like this - it often hangs on very large files. For now, syntax highlighting performance is still an open issue - https://github.com/atom/atom/issues/979 https://github.com/atom/atom/issues/979
- jonstewart 11y agoInteractive highlighting is probably not the right thing, but it would be good when first opening a large file. I suspect most of the overhead, though, is just in maintaining state related to the highlighted sections and not in the initial matching, but maybe. Another neat application might be ad blocking extensions, where there are bajillions of rules. The text is small, but the rules update infrequently enough to make it worthwhile and there are so many repeated requests from a page load that a smidgen improvement in evaluation could lead to a perceptible page load decrease.