In other news, looking at the Criterion graphs:

  • looking up matchers via contstants is a massive ~30% win.
  • roto is so much faster than Lua, it is not funny: two orders of magnitude on a test that always returns the same verdict, immediately.

Previously, Lua had the advantage of having global variables, so accessing pre-compiled stuff was considerably faster there. But with emulating globals in Roto, that advantage is lost.

Lua retains the advantage of being a more familiar, and less limited language however. And the advantage of Fennel: the number one reason I added a Lua engine in the first place.

"Tonight" turned into "tomorrow", and I'm back to thinking about benches. I will keep some of them in iocaine, afterall, because it makes sense to have local benchmarks for some core functionalities:

  • garbage generation (with our without minify)
  • QR code generation (png, inline-svg, external-svg)
  • regex-based generation
  • trivial request handlers for both roto and lua
  • particular request handler-specific benches (hashmap/constant lookups for roto)

I can have an external benchmark for more complex stuff.

 21 files changed, 414 insertions(+), 732 deletions(-)

So far, so good.

What this is? This is lifting out the various matchers common between the Roto and Lua engines into their own thing, and using thin wrappers from Roto/Lua around that, instead of reimplementing every matcher for both.

It also changes the signature of the Roto functions from function init() -> Verdict[Unit, String] to fn init() -> bool? and function decide(request: Request) -> Verdict[Outcome, Outcome] to fn decide(request: Request) -> Outcome?.

I'm yet to make the const-ification thing happen, which will slightly tilt the diffstat towards additions, but hopefully not by much.

1+ more replies (not shown)