Repository navigation
Conversation
While wasm2go strips unused Module receivers on compiled functions,
libc-gen retains them, allocating bound-method closures in indirect call
tables.
Run RemoveReceiver across tree-shaken functions in libc-gen so pure
helpers emit plain package-level functions. This also requires
unexported receiverless functions be matched in `-provided` files so
wasm2go emits the calls without a Module receiver.
Benchmarks on go-sqlite3 (wasm2go -unsafe):
goos: linux
goarch: amd64
pkg: github.com/ncruces/go-sqlite3/driver
cpu: AMD EPYC 7B13
│ before │ after │
│ sec/op │ sec/op vs base │
_loop 602.9m ± 2% 584.4m ± 1% -3.07% (p=0.001 n=8)
pkg: github.com/ncruces/go-sqlite3/ext/stats
│ before │ after │
│ sec/op │ sec/op vs base │
_average 87.89n ± 3% 87.06n ± 1% -0.95% (p=0.016 n=8)
_variance 107.8n ± 2% 106.9n ± 1% ~ (p=0.068 n=8)
geomean 97.34n 96.47n -0.89%
pkg: github.com/ncruces/go-sqlite3/vfs/tests/speedtest1
│ before │ after │
│ sec/op │ sec/op vs base │
_speedtest1 71.47m ± 1% 72.13m ± 2% ~ (p=0.195 n=8)
Owner
|
The approach in #73 seems simpler, I'll go with that if you don't mind. |
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.
While wasm2go strips unused Module receivers on compiled functions,
libc-gen retains them, allocating bound-method closures in indirect call
tables.
Run RemoveReceiver across tree-shaken functions in libc-gen so pure
helpers emit plain package-level functions. This also requires
unexported receiverless functions be matched in
-providedfiles sowasm2go emits the calls without a Module receiver.
Benchmarks on go-sqlite3 (wasm2go -unsafe):