Has anyone done any benchmarking on techniques for writing state machines in Dart?
I'm writing a template engine for fun and I've been copying scanning code from the html5lib package as a way to get started. Its state machine represents states as functions (tear-off methods, actually) and it uses a trampoline to go to the next state.
This seems well-organized, but since the html5lib package was ported from Python, I'm wondering if this is actually the best-performing way to represent a state machine in Dart? (And here I care about performance of JavaScript emitted by dart2js, not the VM.)
I have similar questions about how best to scan the characters in a string, if anyone wants to chime in.
The equivalent code in Go's html parser tries pretty hard to avoid unnecessary allocations, but perhaps that's not as much of an improvement in Dart-generated JavaScript?
- Brian