FWIW, there is a similar project [1] which compiles a regex to bytecode. The benchmarks [2] are impressive. [1] https://github.com/humio/jitrex [1] https://github.com/humio/jitrex?tab=readme-ov-file#performan...
Needle: A DFA Based Regex Library That Compiles to JVM ByteCode
11–16 of 16 posts
Re: Needle: A DFA Based Regex Library That Compiles to JVM ByteCode
#12By looking at the benchmarks, it is interesting to see how much an advantage have non-backtracking engines versus the default Java one. It is also interesting that most of the regular expressions I happen to write are not backtracking, so it’s likely I’m paying a ticket every time for a feature I’m not going to see. It would be interesting if the default Java class the implements regular expressions would detect whet…
The backtracking engines ahead of are pcre2/jit, javascript/v8, d/ldc/std-regex (technically a hybrid I believe) and regress. Java's engine is about on par with Python's and Perl's (which are both written in C).
Re: Needle: A DFA Based Regex Library That Compiles to JVM ByteCode
#13looks very interesting - coming from the perl (ie the original PCRE) it’s rather a pity that this is focused on the JVM since Java is not the most regex friendly authoring environment (sorry I do not know if other JVM denizens like Kotlin / Clojure have more natural regex syntax) Larry Walls version 2 of PCRE is doing some interesting innovation which, while continuing the model of a character level syntax where punc…
val regex = """([\w\s]+) is (\d+) years old""".toRegex()Re: Needle: A DFA Based Regex Library That Compiles to JVM ByteCode
#14By looking at the benchmarks, it is interesting to see how much an advantage have non-backtracking engines versus the default Java one. It is also interesting that most of the regular expressions I happen to write are not backtracking, so it’s likely I’m paying a ticket every time for a feature I’m not going to see. It would be interesting if the default Java class the implements regular expressions would detect whet…
The set of regex engines being compared here is pretty small, and even among backtracking regex engines, Java's is pretty slow. See: https://github.com/BurntSushi/rebar?tab=readme-ov-file#summa... The backtracking engines ahead of are pcre2/jit, javascript/v8, d/ldc/std-regex (technically a hybrid I believe) and regress. Java's engine is about on par with Python's and Perl's (which are both written in C).
Also, I’ve learned a lot from your code. A lot of this project was stubbornly banging my head against the problem, but whenever I wanted to see how another engine did things, your library was the one I looked at.
Re: Needle: A DFA Based Regex Library That Compiles to JVM ByteCode
#15Earlier quoted context omitted.
The set of regex engines being compared here is pretty small, and even among backtracking regex engines, Java's is pretty slow. See: https://github.com/BurntSushi/rebar?tab=readme-ov-file#summa... The backtracking engines ahead of are pcre2/jit, javascript/v8, d/ldc/std-regex (technically a hybrid I believe) and regress. Java's engine is about on par with Python's and Perl's (which are both written in C).
I’d definitely like to get needle into rebar (or a branch of it) and be able to run a broader set of comparisons. Also, I’ve learned a lot from your code. A lot of this project was stubbornly banging my head against the problem, but whenever I wanted to see how another engine did things, your library was the one I looked at.
Hopefully it's easy enough to follow the `java` example to add your own.
Re: Needle: A DFA Based Regex Library That Compiles to JVM ByteCode
#16Thank you for semver-ing!