Skip to content

Instantly share code, notes, and snippets.

@fwsGonzo
Last active May 30, 2024 17:38
Show Gist options
  • Save fwsGonzo/1af5b2a9b4f38c1f3d3074d78acdf609 to your computer and use it in GitHub Desktop.
Save fwsGonzo/1af5b2a9b4f38c1f3d3074d78acdf609 to your computer and use it in GitHub Desktop.
Interpreted libriscv vs. LuaJIT
$ ./bench
* All benchmark results are measured in 200x1200 samples
benchmark overhead median 0ns lowest: 0ns highest: 0ns
Self-test running ELF entry at 0x1021C
Calling into event loop...!
event_loop: Checking for work
event_loop: Going to sleep!
add_work: Adding work
Resuming event loop...!
event_loop: Checking for work
work: Doing some work!
event_loop: Going to sleep!
event_loop: Checking for work
event_loop: Going to sleep!
add_work: Adding work
event_loop: Checking for work
work: Doing some work!
event_loop: Going to sleep!
RISC-V self-test OK
libriscv: mips instr 1600025000, time 1.311113, 1220.356342 mip/s
libriscv: call overhead median 4ns lowest: 4ns highest: 5ns
libriscv: preempt overhead median 14ns lowest: 14ns highest: 18ns
libriscv: fork median 209ns lowest: 206ns highest: 230ns
libriscv: resume execution median 3ns lowest: 3ns highest: 5ns
luajit: call overhead median 130ns lowest: 128ns highest: 183ns
After this point, call overhead is subtracted from every benchmark result for both libriscv and Lua
libriscv: array append median 4ns lowest: 3ns highest: 5ns
libriscv: vector append median 10ns lowest: 8ns highest: 11ns
luajit: table append median 29ns lowest: 17ns highest: 46ns
libriscv: 8x arguments median 46ns lowest: 43ns highest: 49ns
libriscv: 8x stored args median 36ns lowest: 35ns highest: 45ns
libriscv: 8x prepared args median 44ns lowest: 43ns highest: 60ns
luajit: 8x arguments median 330ns lowest: 320ns highest: 373ns
libriscv: integer math median 3ns lowest: 3ns highest: 4ns
libriscv: fp math median 9ns lowest: 9ns highest: 12ns
libriscv: exp math median 14ns lowest: 13ns highest: 21ns
libriscv: fib(40) median 172ns lowest: 163ns highest: 216ns
libriscv: taylor(1K) median 5866ns lowest: 5262ns highest: 6012ns
luajit: integer math median 49ns lowest: 47ns highest: 149ns
luajit: fp math median 64ns lowest: 59ns highest: 244ns
luajit: exp math median 63ns lowest: 60ns highest: 85ns
luajit: fib(40) median 59ns lowest: 57ns highest: 179ns
luajit: taylor(1K) median 863ns lowest: 838ns highest: 1003ns
libriscv: syscall overhead median 1ns lowest: 1ns highest: 4ns
libriscv: syscall string median 7ns lowest: 6ns highest: 15ns
luajit: syscall overhead median 12ns lowest: 11ns highest: 136ns
luajit: syscall string median 32ns lowest: 30ns highest: 70ns
libriscv: complex syscall median 60ns lowest: 56ns highest: 65ns
luajit: complex syscall median 771ns lowest: 764ns highest: 788ns
libriscv: micro threads median 129ns lowest: 126ns highest: 147ns
luajit: coroutines median 166ns lowest: 162ns highest: 198ns
libriscv: micro thread args median 190ns lowest: 184ns highest: 201ns
libriscv: full thread args median 190ns lowest: 187ns highest: 199ns
luajit: coroutine args median 217ns lowest: 211ns highest: 240ns
luajit: coroutine args median 240ns lowest: 234ns highest: 256ns
libriscv: naive memcpy median 397ns lowest: 393ns highest: 439ns
libriscv: syscall memcpy median 21ns lowest: 19ns highest: 30ns
luajit: memcpy median 94ns lowest: 88ns highest: 102ns
libriscv: syscall memset median 9ns lowest: 9ns highest: 22ns
libriscv: naive memset median 245ns lowest: 243ns highest: 253ns
luajit: memset median 67ns lowest: 65ns highest: 81ns
libriscv: sieve(10M) median 156ms lowest: 156ms highest: 156ms
luajit: sieve(10M) median 124ms lowest: 124ms highest: 124ms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment