go-restructure icon indicating copy to clipboard operation
go-restructure copied to clipboard

ragel backend with code generation?

Open dgryski opened this issue 9 years ago • 1 comments

No so much a feature request, but perhaps an interesting direction. From a struct tag, generate a ragel machine definition that matches a []byte and stuffs the values into a struct. This would 1) use the ragel regex engine which is considerably faster than Go's, and 2) remove reflection.

dgryski avatar Jan 25 '16 23:01 dgryski

Ah yes this would be very nice. Could done as a go generate step, using go/parser to process the sources and find relevant structs, then generate a FindFoo(val *Foo) function that dumps its results into the provided struct just like restructure.Find but without the reflection. Thanks for the pointer.

alexflint avatar Jan 26 '16 15:01 alexflint