Skip to content

dgryski/go-vmops

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-vmops

Go's regexp package is sufficient for many use cases. However, in cases where performance in paramount, switching to code generation can offer a significant speed increase. See for example, this article on speeding up regexs using the ragel state machine compiler.

However, large goto-based matchers, while significantly faster on native platforms, run into trouble on WebAssembly due the limitations of structured control flow. Compilers can take an exceedingly long time to turn the large generated code into something without any gotos.

The VMOPS output format from libfsm generates a large table of opcodes for a regular expression matcher that can be evaluated with much smaller inner loop. While slower than generating native code, it has the advantage that it can be used successfully on WebAssebmly. Due to libfsm's DFA-based matcher it can still end up being faster than Go's native regexp package.

The opcodes can also be serialized to a binary format to use with go:embed directives or loading from files at runtime with any additional parsing overhead.

About

Interpreter and tooling for libfsm vmops output

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published