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 5, 2023
1 parent a67ecc0 commit 0388b16
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion examples/simd_i8x16.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@
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)
c: list[int] = add_v128(a, b) # type: ignore
print([v for v in c])
print([v for v in c] == [i + j for i, j in zip(a, b)])
2 changes: 1 addition & 1 deletion tests/test_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def test_simd_i8x16_add(self):
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: list[int] = add_v128(a, b) # type: ignore
c: list[int] = add_v128(a, b) # type: ignore
self.assertEqual([v for v in c], [i + j for i, j in zip(a, b)])

def test_calls(self):
Expand Down
2 changes: 1 addition & 1 deletion wasmtime/_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def __str__(self) -> str:
return 'anyref'
if kind == ffi.WASM_FUNCREF.value:
return 'funcref'
return 'ValType(%d)' % kind # type: ignore
return 'ValType(%d)' % kind # type: ignore

def __del__(self) -> None:
if not hasattr(self, '_owner') or not hasattr(self, '_ptr'):
Expand Down
2 changes: 1 addition & 1 deletion wasmtime/_value.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def _unintern(val: int) -> typing.Any:


def get_valtype_attr(ty: ValType) -> str:
return val_id2attr[wasm_valtype_kind(ty._ptr)] # type: ignore
return val_id2attr[wasm_valtype_kind(ty._ptr)] # type: ignore


def val_getter(store_id: int, val_raw: wasmtime_val_raw_t, attr: str) -> typing.Union[int, float, "wasmtime.Func", typing.Any]:
Expand Down

0 comments on commit 0388b16

Please sign in to comment.