aboutsummaryrefslogtreecommitdiff
path: root/bench/snippets/ffi-overhead.mjs
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2023-03-02 19:02:10 -0800
committerGravatar GitHub <noreply@github.com> 2023-03-02 19:02:10 -0800
commit9388b3f8257bc2e580deaece4cd2677928104fc6 (patch)
tree3f6aff2009cef69897f599fe51305b894f81a376 /bench/snippets/ffi-overhead.mjs
parentb469e5035161286abeb1a7726518d1afcc163a51 (diff)
downloadbun-9388b3f8257bc2e580deaece4cd2677928104fc6.tar.gz
bun-9388b3f8257bc2e580deaece4cd2677928104fc6.tar.zst
bun-9388b3f8257bc2e580deaece4cd2677928104fc6.zip
Add a zig fmt action (#2277)
* Add a zig fmt action * add failing file * Setup prettier better * Update prettier-fmt.yml * Fail on error * Update prettier-fmt.yml * boop * boop2 * tar.gz * Update zig-fmt.yml * Update zig-fmt.yml * Update zig-fmt.yml * Update zig-fmt.yml * Update zig-fmt.yml * boop * Update prettier-fmt.yml * tag * newlines * multiline * fixup * Update zig-fmt.yml * update it * fixup * both * w * Update prettier-fmt.yml * prettier all the things * Update package.json * zig fmt * ❌ ✅ * bump * . * quotes * fix prettier ignore * once more * Update prettier-fmt.yml * Update fallback.ts * consistentcy --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Diffstat (limited to 'bench/snippets/ffi-overhead.mjs')
-rw-r--r--bench/snippets/ffi-overhead.mjs31
1 files changed, 8 insertions, 23 deletions
diff --git a/bench/snippets/ffi-overhead.mjs b/bench/snippets/ffi-overhead.mjs
index dcceef7ba..382300ac6 100644
--- a/bench/snippets/ffi-overhead.mjs
+++ b/bench/snippets/ffi-overhead.mjs
@@ -1,13 +1,4 @@
-import {
- viewSource,
- dlopen,
- CString,
- ptr,
- toBuffer,
- toArrayBuffer,
- FFIType,
- callback,
-} from "bun:ffi";
+import { viewSource, dlopen, CString, ptr, toBuffer, toArrayBuffer, FFIType, callback } from "bun:ffi";
import { bench, group, run } from "mitata";
const types = {
@@ -235,9 +226,7 @@ var opened;
try {
opened = dlopen("/tmp/bun-ffi-test.dylib", types);
} catch (e) {
- throw new Error(
- "Please run `make compile-ffi-test` to compile the ffi test library"
- );
+ throw new Error("Please run `make compile-ffi-test` to compile the ffi test library");
}
const {
@@ -403,10 +392,10 @@ group("returns_true", () => {
group("return_a_function_ptr_to_function_that_returns_true", () => {
bench("return_a_function_ptr_to_function_that_returns_true (raw)", () =>
- raw_return_a_function_ptr_to_function_that_returns_true()
+ raw_return_a_function_ptr_to_function_that_returns_true(),
);
bench("return_a_function_ptr_to_function_that_returns_true", () =>
- return_a_function_ptr_to_function_that_returns_true()
+ return_a_function_ptr_to_function_that_returns_true(),
);
});
group("returns_42_float", () => {
@@ -427,8 +416,7 @@ group("identity_double", () => {
});
var raw_return_a_function_ptr_to_function_that_returns_true =
- return_a_function_ptr_to_function_that_returns_true.native ??
- return_a_function_ptr_to_function_that_returns_true;
+ return_a_function_ptr_to_function_that_returns_true.native ?? return_a_function_ptr_to_function_that_returns_true;
var raw_returns_42_float = returns_42_float.native ?? returns_42_float;
var raw_returns_42_double = returns_42_double.native ?? returns_42_double;
var raw_identity_float = identity_float.native ?? identity_float;
@@ -437,14 +425,11 @@ var raw_returns_true = returns_true.native ?? returns_true;
var raw_returns_false = returns_false.native ?? returns_false;
var raw_returns_42_char = returns_42_char.native ?? returns_42_char;
var raw_returns_42_uint8_t = returns_42_uint8_t.native ?? returns_42_uint8_t;
-var raw_returns_neg_42_int8_t =
- returns_neg_42_int8_t.native ?? returns_neg_42_int8_t;
+var raw_returns_neg_42_int8_t = returns_neg_42_int8_t.native ?? returns_neg_42_int8_t;
var raw_returns_42_uint16_t = returns_42_uint16_t.native ?? returns_42_uint16_t;
var raw_returns_42_uint32_t = returns_42_uint32_t.native ?? returns_42_uint32_t;
-var raw_returns_neg_42_int16_t =
- returns_neg_42_int16_t.native ?? returns_neg_42_int16_t;
-var raw_returns_neg_42_int32_t =
- returns_neg_42_int32_t.native ?? returns_neg_42_int32_t;
+var raw_returns_neg_42_int16_t = returns_neg_42_int16_t.native ?? returns_neg_42_int16_t;
+var raw_returns_neg_42_int32_t = returns_neg_42_int32_t.native ?? returns_neg_42_int32_t;
var raw_identity_char = identity_char.native ?? identity_char;
var raw_identity_bool = identity_bool.native ?? identity_bool;
var raw_identity_bool = identity_bool.native ?? identity_bool;