Skip to content

Lazy stack#5

Merged
ncruces merged 4 commits intomainfrom
opt
Mar 21, 2026
Merged

Lazy stack#5
ncruces merged 4 commits intomainfrom
opt

Conversation

@ncruces
Copy link
Copy Markdown
Owner

@ncruces ncruces commented Mar 20, 2026

This tries to keep "pure" values unevaluated in the stack.

It generates denser code, which helps the Go compiler (generated code compiles faster, produces smaller binaries).

The problem is convincing myself the optimization is correct.

@ncruces
Copy link
Copy Markdown
Owner Author

ncruces commented Mar 21, 2026

Seems I'm convinced. 🙂

@ncruces ncruces merged commit 482a96e into main Mar 21, 2026
2 checks passed
@ncruces ncruces deleted the opt branch March 21, 2026 09:41
@NyaaaWhatsUpDoc
Copy link
Copy Markdown

nice work on this by the way! decreased ffmpeg source code output from 180MB down to 130MB :)

@ncruces
Copy link
Copy Markdown
Owner Author

ncruces commented Mar 21, 2026

Also I did forget your suggestion for a CLI flag, but I'll probably add one.

I think "reverting" this is just a matter of having pushPure optionally call flush.

That's useful if we ever suspect a bug due to this.

@ncruces
Copy link
Copy Markdown
Owner Author

ncruces commented Mar 25, 2026

The latest version adds a few more "passes" to the optimization pipeline, and results in another 10% reduction for me.

@NyaaaWhatsUpDoc
Copy link
Copy Markdown

oh very nice! I haven't been at the computer in a few days due to moving house, but when I'm back I'll be sure to regenerate and see how it looks 👀

@ncruces
Copy link
Copy Markdown
Owner Author

ncruces commented Mar 27, 2026

Even lazier now. With these I think I've gone from 600k lines for SQLite to less than 200k.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants