Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: add example of linking modules in a plugin #616

Merged
merged 1 commit into from
Dec 1, 2023

Conversation

chrisdickinson
Copy link
Contributor

Add an example of dynamically linking plugins and a benchmark that does an apples-to-apples comparison of reflect using host functions vs. reflect using a linked wasm module. (To my surprise, the host functions are a little bit faster!)

reflect/reflect 65536 bytes
                        time:   [209.62 µs 210.25 µs 211.13 µs]
                        thrpt:  [296.03 MiB/s 297.27 MiB/s 298.16 MiB/s]
                 change:
                        time:   [-0.0996% +0.2021% +0.6613%] (p = 0.32 > 0.20)
                        thrpt:  [-0.6570% -0.2017% +0.0997%]
                        No change in performance detected.
reflect/reflect 655360 bytes
                        time:   [1.9814 ms 1.9839 ms 1.9865 ms]
                        thrpt:  [314.63 MiB/s 315.03 MiB/s 315.43 MiB/s]
                 change:
                        time:   [-0.0460% +0.1310% +0.3133%] (p = 0.15 < 0.20)
                        thrpt:  [-0.3123% -0.1308% +0.0460%]
                        Change within noise threshold.
reflect/reflect 6553600 bytes
                        time:   [20.818 ms 20.839 ms 20.860 ms]
                        thrpt:  [299.61 MiB/s 299.92 MiB/s 300.23 MiB/s]
                 change:
                        time:   [+0.5463% +0.6997% +0.8403%] (p = 0.00 < 0.20)
                        thrpt:  [-0.8333% -0.6949% -0.5434%]
                        Change within noise threshold.
reflect/reflect_linked 65536 bytes
                        time:   [231.47 µs 231.64 µs 231.82 µs]
                        thrpt:  [269.60 MiB/s 269.81 MiB/s 270.02 MiB/s]
                 change:
                        time:   [-0.0548% +0.0832% +0.2227%] (p = 0.24 > 0.20)
                        thrpt:  [-0.2222% -0.0831% +0.0548%]
                        No change in performance detected.
reflect/reflect_linked 655360 bytes
                        time:   [2.1875 ms 2.1889 ms 2.1903 ms]
                        thrpt:  [285.35 MiB/s 285.53 MiB/s 285.71 MiB/s]
                 change:
                        time:   [+0.8201% +0.9253% +1.0262%] (p = 0.00 < 0.20)
                        thrpt:  [-1.0157% -0.9168% -0.8135%]
                        Change within noise threshold.
reflect/reflect_linked 6553600 bytes
                        time:   [22.293 ms 22.310 ms 22.327 ms]
                        thrpt:  [279.93 MiB/s 280.14 MiB/s 280.35 MiB/s]
                 change:
                        time:   [+0.8597% +0.9710% +1.0857%] (p = 0.00 < 0.20)
                        thrpt:  [-1.0741% -0.9617% -0.8523%]
                        Change within noise threshold.

@bhelx
Copy link
Contributor

bhelx commented Dec 1, 2023

We should talk about this as a team I think. I'm still a little confused as to how this will behave on different runtimes. And if it behaves differently, or doesn't work across all of them, we should be a little more cautious about people using it.

@bhelx
Copy link
Contributor

bhelx commented Dec 1, 2023

This is okay to merge though, not a blocker!

@zshipko
Copy link
Contributor

zshipko commented Dec 1, 2023

@bhelx I tested dynamic linking on the Rust-based SDKs and go-sdk - I think only js-sdk is missing support right now.

@chrisdickinson
Copy link
Contributor Author

Thanks for the reviews! @zshipko excellent! I had read through the go-sdk code and found that the kernel was getting linked in, but wasn't 100% sure if other modules in the manifest would get linked in too – I was just about to test this.

I'm tracking JS support for linking here and hope to get it implemented and merged before 1.0.

@chrisdickinson chrisdickinson merged commit 75f2ea2 into main Dec 1, 2023
5 checks passed
@chrisdickinson chrisdickinson deleted the chris/20231128-add-linking-example branch December 1, 2023 19:38
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.

None yet

3 participants