Skip to content

Update wasmtime-go#3544

Merged
srenatus merged 3 commits intoopen-policy-agent:mainfrom
olivierlemasle:update-wasmtime-go
Jun 21, 2021
Merged

Update wasmtime-go#3544
srenatus merged 3 commits intoopen-policy-agent:mainfrom
olivierlemasle:update-wasmtime-go

Conversation

@olivierlemasle
Copy link
Copy Markdown
Contributor

@olivierlemasle olivierlemasle commented Jun 10, 2021

This version of wasmtime-go reflects new Wasmtime C API specified by Wasmtime RFC 11, and requires some changes in the way it is called.

Also, the imports that were present only to include the C headers and static lib in "go vendored" dependencies are no longer required, because these paths are now imported by wasmtime-go itself in includebuild.go.

@tsandall
Copy link
Copy Markdown
Member

@olivierlemasle thanks for opening this PR. I'll wait for @srenatus to weigh in next week.

@tsandall tsandall requested a review from srenatus June 15, 2021 12:39
This version of wasmtime-go reflects new Wasmtime C API specified
by [RFC 11], and requires some changes in the way it is called.

Also, the imports that were present only to include the C headers and static
lib in `go vendor`ed dependencies are no longer required, because these paths
are now imported by wasmtime-go itself in [includebuild.go].

[RFC 11]: bytecodealliance/rfcs#11
[includebuild.go]: https://github.com/bytecodealliance/wasmtime-go/blob/2f1b8a9d0/includebuild.go#L13-L17

Signed-off-by: Olivier Lemasle <[email protected]>
@srenatus
Copy link
Copy Markdown
Contributor

@olivierlemasle thanks a lot for doing this, I really appreciate your help here 😃

The code changes look good to me, I'll play with it some locally and merge when nothing surprising happens 🚀

@srenatus
Copy link
Copy Markdown
Contributor

What a pleasant surprise in benchmarks:

name                                    old time/op  new time/op  delta
WASMArrayIteration/10-16                 439µs ± 3%    86µs ± 6%  -80.49%  (p=0.008 n=5+5)
WASMArrayIteration/100-16                443µs ± 2%   109µs ± 4%  -75.34%  (p=0.008 n=5+5)
WASMArrayIteration/1000-16               573µs ± 2%   296µs ± 4%  -48.31%  (p=0.008 n=5+5)
WASMArrayIteration/10000-16             2.22ms ± 3%  1.95ms ± 3%  -12.22%  (p=0.008 n=5+5)
WASMSetIteration/10-16                   429µs ± 2%    90µs ± 4%  -79.09%  (p=0.008 n=5+5)
WASMSetIteration/100-16                  453µs ± 3%   119µs ± 3%  -73.72%  (p=0.008 n=5+5)
WASMSetIteration/1000-16                 698µs ± 5%   397µs ± 3%  -43.13%  (p=0.008 n=5+5)
WASMSetIteration/10000-16               3.80ms ± 5%  3.44ms ± 6%   -9.43%  (p=0.016 n=5+5)
WASMObjectIteration/10-16                432µs ± 4%    92µs ± 6%  -78.75%  (p=0.008 n=5+5)
WASMObjectIteration/100-16               457µs ± 3%   128µs ± 4%  -72.05%  (p=0.008 n=5+5)
WASMObjectIteration/1000-16              712µs ± 7%   429µs ± 5%  -39.77%  (p=0.008 n=5+5)
WASMObjectIteration/10000-16            3.86ms ± 2%  3.83ms ± 4%     ~     (p=0.690 n=5+5)
WASMLargeJSON/10x10-16                   488µs ± 5%   102µs ± 4%  -79.16%  (p=0.008 n=5+5)
WASMLargeJSON/10x100-16                  524µs ± 3%   148µs ± 2%  -71.77%  (p=0.008 n=5+5)
WASMLargeJSON/10x1000-16                 909µs ± 5%   648µs ± 3%  -28.69%  (p=0.008 n=5+5)
WASMLargeJSON/10x10000-16               6.07ms ±10%  5.80ms ± 5%     ~     (p=0.222 n=5+5)
WASMLargeJSON/100x100-16                 765µs ± 4%   459µs ± 4%  -39.95%  (p=0.008 n=5+5)
WASMLargeJSON/100x1000-16               3.80ms ±10%  3.47ms ± 7%     ~     (p=0.056 n=5+5)
WASMVirtualDocs/total=1/hit=1-16         446µs ± 3%    88µs ± 6%  -80.34%  (p=0.008 n=5+5)
WASMVirtualDocs/total=10/hit=1-16        446µs ± 4%    87µs ± 4%  -80.40%  (p=0.008 n=5+5)
WASMVirtualDocs/total=100/hit=1-16       445µs ± 3%   101µs ± 3%  -77.22%  (p=0.008 n=5+5)
WASMVirtualDocs/total=1000/hit=1-16      480µs ± 4%   185µs ± 4%  -61.45%  (p=0.008 n=5+5)
WASMVirtualDocs/total=10/hit=10-16       431µs ± 4%    93µs ± 3%  -78.43%  (p=0.008 n=5+5)
WASMVirtualDocs/total=100/hit=10-16      434µs ± 2%   103µs ± 8%  -76.23%  (p=0.008 n=5+5)
WASMVirtualDocs/total=1000/hit=10-16     473µs ± 3%   184µs ± 5%  -61.05%  (p=0.008 n=5+5)
WASMVirtualDocs/total=100/hit=100-16     449µs ± 4%   138µs ± 4%  -69.29%  (p=0.008 n=5+5)
WASMVirtualDocs/total=1000/hit=100-16    510µs ± 3%   212µs ± 3%  -58.49%  (p=0.008 n=5+5)
WASMVirtualDocs/total=1000/hit=1000-16   841µs ± 2%   588µs ± 3%  -30.06%  (p=0.008 n=5+5)

@olivierlemasle would you have any idea why it's gotten that much faster? I'm starting to wonder if I've mismanaged my go test -bench run here... (go test --timeout=20m -run=^$ -tags opa_wasm,wasm_sdk_e2e ./internal/wasm/sdk/opa -bench BenchmarkWASM -count=5)

Copy link
Copy Markdown
Contributor

@srenatus srenatus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks again! 🎉

@srenatus srenatus merged commit 94373c5 into open-policy-agent:main Jun 21, 2021
@olivierlemasle olivierlemasle deleted the update-wasmtime-go branch June 22, 2021 07:15
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.

3 participants