forked from bytecodealliance/wasmtime-py
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FIXES bytecodealliance#137: make calling wasm from python 7x faster
- Loading branch information
1 parent
1446d79
commit 1ca73e9
Showing
6 changed files
with
65 additions
and
26 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
# Example of instantiating a wasm module and calling an export on it | ||
|
||
from wasmtime import Store, Module, Instance | ||
|
||
from functools import partial | ||
store = Store() | ||
module = Module.from_file(store.engine, './examples/gcd.wat') | ||
instance = Instance(store, module, []) | ||
gcd = instance.exports(store)["gcd"] | ||
|
||
gcd_func = partial(gcd, store) | ||
print("gcd(6, 27) = %d" % gcd(store, 6, 27)) | ||
print("gcd(6, 27) = %d" % gcd_func(6, 27)) |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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