Repository navigation
bench: add map-ops and coroutine-gen kernels - #318
Merged
Merged
Conversation
roadmap.md lists maps and coroutines as P1 benchmark areas, and no kernel covered either. map-ops: an i32->i32 map of 256 entries; insert, look up (half miss), update, delete, sum. Keys are offset by 1<<27 so GopherLua hashes them instead of growing its array part. coroutine-gen: a generator yields 512 values that the consumer resumes and sums; Go uses iter.Pull. Tengo has neither integer-keyed maps nor coroutines; gpython dicts take only string keys (map-ops); Yaegi has no iter package (coroutine-gen). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
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.
Summary
docs/roadmap.mdP1 lists maps and coroutines as benchmark areas; none of the 26 kernels covered either.key(k) = (1<<27) + k*7919 % 65521, look up (odd k probekey(k)+65521, always a miss), update even k, delete k%4==0, final sum; resultsum*1024 + len= 58785984. The1<<27offset keeps GopherLua on its hash part (it stores integer keys up to 2^26 in the array part, which measured array growth: 5.58 MB/op before, 114 KB after).(i*i + 7*i) % 1009for i < 512; the consumer resumes until done and sums mod 65521. Go usesiter.Pull; Lua coroutines, JS generator, Python generator;.mvmusesyield/resume/coro.done/coro.value.iterpackage). Recorded inbenchmarks/README.mdwith the existing skip style.Observations (local, M4 Pro, 300 ms x3)
JIT gains nothing on either: map operations bridge to the interpreter, and
yield/resumemake the translator decline the unit. Follow-up issues will track these.Review
Independent Opus review: algorithms identical across runtimes, int32-safe,
.mvmstack/ref handling sound. Its MEDIUM (GopherLua array part) and two LOWs (single lookup in JS/Python, README sentence) are applied.Validation
go test ./...inbenchmarks/(TestKernels threaded+jit, runtime checks for every registered runtime)make check,git diff --check(pre-commit)docs/benchmarks.mdis regenerated by CI.🤖 Generated with Claude Code