Regex DNA benchmark

Jascha Wetzel firstname at mainia.de
Sat Dec 1 07:18:09 PST 2007


bearophile wrote:
> - Regarding the Shootout I don't know how much useful it can be, because that site accepes only a really limited number of external libs, and generally accepts only a single sourcecode (maybe your code spits out D code that can be inserted in a single D sourcecode, but I don't know if the Shootout site accepts that).
> - Regarding the compilation to D code, does it work only at compile time? Or does it call DMD at runtime?

unfortunately, the data structures for a DFA based regex engine are too 
complex to (realistically) implement it with compile-time means.
it compile the regex to a DFA and interprets it at runtime, or generates 
D code from it, that can be compiled along with the rest of the program.

> - Regarding the generation of normal code, that later can be compiled, time ago I have found this, to use REs in the lwc compiler:
> http://students.ceid.upatras.gr/~sxanth/lwc/ex15.html
> - There are TONS of open source RE engines around (the RE of TCL is very fast). I presume we can find one of them with a license fit for D, so we can just copy it into the std lib of D without writing yet another (slow, buggy, limited, etc) one.

most regex engines are more general parsers that use backtracking and 
are slow by design (that includes Perl's and Java's engine, PCRE, and 
many more). that's why i bothered to implement yet another engine.
my engine uses the same approach as TRE, one of the very few engines out 
there that don't do backtracking (i think TCL's is another one).
here are details on these issues:
http://swtch.com/~rsc/regexp/regexp1.html



More information about the Digitalmars-d mailing list