Get the latest tech news
Needle: A DFA Based Regex Library That Compiles to JVM ByteCode
ny years ago, Kragen complained about the implementation and performance of Java regexes, and suggested that an implementation that emitted JVM bytecode could perform better. It's been a minute, but I'm happy to report that complaining on the Internet has served its purpose.
It detects required prefixes, suffixes and infixes that can be found using String.indexOf, as well as cases where the first character can be easily tested in a while loop (e.g.[Ss]). I've written a number of benchmarks, covering many different cases, but need to write code to repeatably report and compare results. Second, for the remaining regexes, that do not allow using a fast initial loop, I'll have to change the generated code to match or exceed the performance of brics.
Or read this on Hacker News