Skip to content

LLM-Assisted Binaryen Optimization Workflow #415

Closed

Description

@unxed

Hi!

I have a question about the optimization workflow used for go-sqlite3.

Do you use any kind of automated profiling + aggressive optimization of hot paths with an LLM on top of Binaryen?

At first glance, this approach may seem prohibitively expensive, but I think the economics are actually quite different. The expensive part only needs to be done once per major upstream release. When a new minor upstream version comes out, you can simply show the model the diff from the previous optimization and say: "Optimize the new version in the same way!" Rewriting code based on an existing reference is something that doesn't require a top-tier LLM.

I experimented with a similar approach in my wasm2go zlib port. I needed compression to produce a bit-for-bit compatible stream with the original C zlib, so replacing the algorithm with a different implementation wasn't an option.

I aggressively optimized only the compression path, since I didn't need decompression. I asked LLM to optimize like top demo scene hacker. I didn't even need the latest models like Opus; the Gemini 3 series handled it perfectly. The resulting zlib4go compression performance ended up even slightly faster than the original C zlib in my benchmark. The project is here:

https://github.com/unxed/zlib4go

The repository also contains the benchmark results and the generated Go/assembly implementation.

I'm curious whether you've considered this kind of workflow for go-sqlite3, or perhaps are already using something similar.

PS: I'm using your excellent lib in
https://github.com/unxed/tar
https://github.com/unxed/zipper
https://github.com/unxed/f4
Great job, thanks!

Activity

  1. Repository owner locked and limited conversation to collaborators on Aug 15, 2026
  2. converted this issue into a discussion #416 on Aug 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions