aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Aapo Alasuutari <aapo.alasuutari@gmail.com> 2022-10-19 07:12:33 +0300
committerGravatar GitHub <noreply@github.com> 2022-10-18 21:12:33 -0700
commit6223030360c121e272aad98c7d1c14a009c5fc1c (patch)
tree8a84a55e53d833f4bd95cb135bf09d477cab8a94
parent1835e4b9f93ba9324bca2bed588f42c93a2772de (diff)
downloadbun-6223030360c121e272aad98c7d1c14a009c5fc1c.tar.gz
bun-6223030360c121e272aad98c7d1c14a009c5fc1c.tar.zst
bun-6223030360c121e272aad98c7d1c14a009c5fc1c.zip
Use buffer type for Deno FFI binding to align with Bun usage (#1321)
* Use buffer type for Deno FFI binding to align with Bun usage * Prettier
-rw-r--r--bench/ffi/deno.js8
1 files changed, 3 insertions, 5 deletions
diff --git a/bench/ffi/deno.js b/bench/ffi/deno.js
index ae971a344..0b4832f1a 100644
--- a/bench/ffi/deno.js
+++ b/bench/ffi/deno.js
@@ -11,17 +11,15 @@ const {
} = Deno.dlopen(path, {
ffi_noop: { parameters: [], result: "void" },
ffi_string: { parameters: [], result: "pointer" },
- ffi_hash: { parameters: ["pointer", "u32"], result: "u32" },
+ ffi_hash: { parameters: ["buffer", "u32"], result: "u32" },
});
const bytes = new Uint8Array(64);
group("deno:ffi", () => {
bench("noop", () => ffi_noop());
- bench("hash", () => ffi_hash(Deno.UnsafePointer.of(bytes), bytes.byteLength));
- bench("c string", () =>
- new Deno.UnsafePointerView(ffi_string()).getCString()
- );
+ bench("hash", () => ffi_hash(bytes, bytes.byteLength));
+ bench("c string", () => Deno.UnsafePointerView.getCString(ffi_string()));
});
await run();