Skip to content

Commit

Permalink
FIXES bytecodealliance#137: make calling wasm from python 7x faster
Browse files Browse the repository at this point in the history
  • Loading branch information
muayyad-alsadi committed Apr 4, 2023
1 parent e6c054b commit 8bc29e6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions examples/simd_i8x16.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import ctypes

from functools import partial
from wasmtime import Store, Module, Instance
from wasmtime import Store, Module, Instance, Func


store = Store()
Expand All @@ -25,7 +25,8 @@

instance = Instance(store, module, [])
vector_type = ctypes.c_uint8 * 16
add_v128 = partial(instance.exports(store)["add_v128"], store)
add_v128_f: Func = instance.exports(store)["add_v128"]
add_v128 = partial(add_v128_f, store)
a = vector_type(*(i for i in range(16)))
b = vector_type(*(40 + i for i in range(16)))
c = add_v128(a, b)
Expand Down
3 changes: 2 additions & 1 deletion tests/test_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ def test_simd_i8x16_add(self):

instance = Instance(store, module, [])
vector_type = ctypes.c_uint8 * 16
add_v128 = partial(instance.exports(store)["add_v128"], store)
add_v128_f: Func = instance.exports(store)["add_v128"]
add_v128 = partial(add_v128_f, store)
a = vector_type(*(i for i in range(16)))
b = vector_type(*(40 + i for i in range(16)))
c = add_v128(a, b)
Expand Down

0 comments on commit 8bc29e6

Please sign in to comment.