Draft
Conversation
Contributor
Author
Contributor
Author
jiribenes
added a commit
that referenced
this pull request
Mar 23, 2026
Previously, we: 1. for each `var`, we allocated a new closure for its own `set` method 2. for each `RESET`, we allocated two closures for their `fresh` and `arena` methods ... what if we, uh, didn't do that? --- This could have been resolved both with prototypes and classes, but I chose to use classes since intent is important and classes are better recognisable by tooling. (and by JSDoc which is relevant for #1218) The benchmark results are pretty strong: geomean is like a **4-5% speedup** on my machine, and _all benchmarks_ got faster, yet! These are the biggest changes (ran with hyperfine, warmup = 5, N ≥ 10, inputs from the `config_js.txt` file), everything else is negligible as per the Welch t-test (using mean, stddev & number of runs; the tests where hyperfine complained about outliers are deemed as not significant): Benchmark | main after #1330 | this PR | Δ -- | -- | -- | -- mandelbrot | 177 ms | 108 ms | −38.8% sieve | 150 ms | 134 ms | −10.6% bounce | 120 ms | 114 ms | −5.2% storage | 690 ms | 672 ms | −2.5% product_early | 248 ms | 241 ms | −2.7% triples | 375 ms | 366 ms | −2.4% dyck_one | 404 ms | 385 ms | −4.8% number_matrix | 357 ms | 344 ms | −3.7% financial_format | 294 ms | 284 ms | −3.4%
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Most of the contents are scaffolding, what this really adds is:
libraries/js/effekt_*.jsusing the JSDoc syntax// @ts-checkcomment at the top of the fileThis means that we get some light form of type checking when investigating the JS output in VSCode.
It's especially useful when writing FFI. :)
I have not tested this properly, I really only tried it on two examples.
To me, this is just a first step: the type annotations currently present are a combination of my own vibes and of Claude's ideas of what the types should be. There's also a lot of
@ts-ignorecomments and casts toanyand similar things to make TS shut up, this could likely be much more improved, hence the draft status of this PR.