diff --git a/tests/ffi/README.md b/tests/ffi/README.md index 3317f29..f988a7b 100644 --- a/tests/ffi/README.md +++ b/tests/ffi/README.md @@ -49,30 +49,34 @@ int add(int a, int b) { bench_scale = 1000000 -**Lune ffi call function** +**Lune ffi** -> cargo run run tests/ffi/benchmark/external_call -> cargo run --profile=release run tests/ffi/benchmark/external_call +Command: `cargo run run tests/ffi/benchmark/external_call` +Command: `cargo run --profile=release run tests/ffi/benchmark/external_call` -Lune release target: 0.205127 (sec) -Lune dev target: 1.556489 (sec) +- Device1 + Lune release target: 0.205127 (sec) + Lune dev target: 1.556489 (sec) + > Commit: ddf0c4c -**LuaJit ffi call function** +**LuaJit ffi** -> luajit tests/ffi/benchmark/external_call/luajit.lua +Command: `luajit tests/ffi/benchmark/external_call/luajit.lua` -LuaJIT 2.1.1727870382: 0.001682 (sec) -flags = JIT ON SSE3 SSE4.1 BMI2 fold cse dce fwd dse narrow loop abc sink fuse +- Device1: 0.001682 (sec) + > LuaJIT 2.1.1727870382 + > (flags = JIT ON SSE3 SSE4.1 BMI2 fold cse dce fwd dse narrow loop abc sink fuse) -**Deno ffi call function** +**Deno ffi** -> deno run --unstable-ffi --allow-ffi ./tests/ffi/benchmark/external_call/deno.ts +Command: `deno run --unstable-ffi --allow-ffi ./tests/ffi/benchmark/external_call/deno.ts` -Deno 1.46.3: 0.006384 (sec) -v8 = 12.9.202.5-rusty +- Device1: 0.006384 (sec) + > Deno 1.46.3 (v8 = 12.9.202.5-rusty) **Sysinformation** -> CPU: AMD Ryzen 5 7600 (12) @ 5.1 -> MEM: 61898MiB 5600 MT/s -> KERNEL: 6.8.12-2-pve (Proxmox VE 8.2.7 x86_64) +- Device1 + > CPU: AMD Ryzen 5 7600 (12) @ 5.1 + > MEM: 61898MiB 5600 MT/s + > KERNEL: 6.8.12-2-pve (Proxmox VE 8.2.7 x86_64) diff --git a/tests/ffi/external_pointer/lib.c b/tests/ffi/external_pointer/lib.c index 0714622..697fd09 100644 --- a/tests/ffi/external_pointer/lib.c +++ b/tests/ffi/external_pointer/lib.c @@ -1,3 +1,3 @@ -void pointer(int *a) { +void pointer_write(int *a) { *a = 123; } diff --git a/tests/ffi/pretty_print.luau b/tests/ffi/pretty_print.luau index bac478b..815c261 100644 --- a/tests/ffi/pretty_print.luau +++ b/tests/ffi/pretty_print.luau @@ -14,7 +14,7 @@ assert(tostring(c.int:ptr():arr(5)) == " , length = 5 ") assert(typeof(c.fn({ c.int }, c.int)) :: string == "CFn") assert(tostring(c.fn({ c.int }, c.int)) == " (int) -> int ") -assert(tostring(c.fn({ c.int, c.double }, c.int)) == " (int, double) -> int ") +assert(tostring(c.fn({ c.int, ffi.f32 }, c.int)) == " (int, f32) -> int ") assert(tostring(c.fn({ c.int:ptr() }, c.int)) == " () -> int ") assert(tostring(c.fn({ c.int }, c.int:ptr())) == " (int) -> ") assert(tostring(c.fn({ c.int:ptr() }, c.int:ptr())) == " () -> ")