Dmitry Olshansky:

> Speaking more of run-time version of regex, it is essentially running a 
> VM that executes instructions that do various kinds of match-this, 
> match-that. The VM dispatch code is quite slow, the optimal _threaded_ 
> code requires either doing it in _assembly_ or _computed_ goto in the 
> language. The VM _dispatch_ takes up to 30% of time in the default matcher.

I have used computed gotos in GCC-C to implement some quite efficient finite 
state machines to be used in computational biology. I've seen 20%+ speedups 
compared to my alternative switch-based implementation. So I'd like computed 
gotos in D too.

Both GCC and LLVM back-ends support computed gotos (despite the asm produced by 
LLVM on them is not as good as GCC one). If people feel the desire to add 
compiler-specific computed gotos to D, they will risk adding them with a 
different syntax on each present and future compiler. Even if dmd doesn't 
support computed gotos, defining a standard syntax (like it was done for years 
for vector operations) is a way to avoid that balkanization, and it will help 
LDC and GDC developers add this feature to their compilers.

Bye,
bearophile

Reply via email to