Skip to content

Instantly share code, notes, and snippets.

@fwsGonzo
Last active May 30, 2024 17:41
Show Gist options
  • Save fwsGonzo/5ac8f4d8ca84e97b0c527aec76a86fe9 to your computer and use it in GitHub Desktop.
Save fwsGonzo/5ac8f4d8ca84e97b0c527aec76a86fe9 to your computer and use it in GitHub Desktop.
Interpreted libriscv vs. Luau (both actual sandboxes)
$ ./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.563432, 1023.405428 mip/s
libriscv: call overhead median 4ns lowest: 4ns highest: 4ns
libriscv: preempt overhead median 18ns lowest: 17ns highest: 27ns
libriscv: fork median 208ns lowest: 201ns highest: 221ns
libriscv: resume execution median 3ns lowest: 3ns highest: 7ns
luau: call overhead median 86ns lowest: 86ns highest: 95ns
After this point, call overhead is subtracted from every benchmark result for both libriscv and Lua
libriscv: array append median 4ns lowest: 2ns highest: 7ns
libriscv: vector append median 8ns lowest: 8ns highest: 12ns
luau: table append median 24ns lowest: 23ns highest: 32ns
libriscv: 8x arguments median 50ns lowest: 46ns highest: 68ns
libriscv: 8x stored args median 40ns lowest: 35ns highest: 51ns
libriscv: 8x prepared args median 48ns lowest: 45ns highest: 69ns
luau: 8x arguments median 239ns lowest: 233ns highest: 252ns
libriscv: integer math median 3ns lowest: 2ns highest: 5ns
libriscv: fp math median 11ns lowest: 10ns highest: 14ns
libriscv: exp math median 16ns lowest: 14ns highest: 24ns
libriscv: fib(40) median 205ns lowest: 204ns highest: 215ns
libriscv: taylor(1K) median 5876ns lowest: 5482ns highest: 6380ns
luau: integer math median 44ns lowest: 40ns highest: 51ns
luau: fp math median 51ns lowest: 49ns highest: 154ns
luau: exp math median 58ns lowest: 56ns highest: 67ns
luau: fib(40) median 488ns lowest: 479ns highest: 506ns
luau: taylor(1K) median 21319ns lowest: 20496ns highest: 22478ns
libriscv: syscall overhead median 3ns lowest: 2ns highest: 3ns
libriscv: syscall string median 7ns lowest: 7ns highest: 9ns
luau: syscall overhead median 17ns lowest: 15ns highest: 27ns
luau: syscall string median 35ns lowest: 33ns highest: 47ns
libriscv: complex syscall median 60ns lowest: 55ns highest: 65ns
luau: complex syscall median 721ns lowest: 712ns highest: 731ns
libriscv: micro threads median 126ns lowest: 122ns highest: 137ns
luau: coroutines median 189ns lowest: 184ns highest: 199ns
libriscv: micro thread args median 180ns lowest: 172ns highest: 214ns
libriscv: full thread args median 215ns lowest: 191ns highest: 240ns
luau: coroutine args median 258ns lowest: 253ns highest: 273ns
luau: coroutine args median 248ns lowest: 243ns highest: 260ns
libriscv: naive memcpy median 411ns lowest: 314ns highest: 427ns
libriscv: syscall memcpy median 20ns lowest: 19ns highest: 33ns
luau: memcpy median 2248ns lowest: 2227ns highest: 2320ns
libriscv: syscall memset median 11ns lowest: 9ns highest: 14ns
libriscv: naive memset median 244ns lowest: 194ns highest: 252ns
luau: memset median 1661ns lowest: 1607ns highest: 1690ns
libriscv: sieve(10M) median 139ms lowest: 139ms highest: 139ms
luau: sieve(10M) median 408ms lowest: 408ms highest: 408ms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment