mirror of
https://github.com/wren-lang/wren.git
synced 2026-01-10 21:58:48 +01:00
I've got some ideas on how to tweak the embedding API, but I want to see what performance impact they have first, so this adds a little benchmark that just calls a foreign method a ton of times.
21 lines
716 B
Plaintext
21 lines
716 B
Plaintext
class Benchmark {
|
|
foreign static arguments(a, b, c, d)
|
|
}
|
|
|
|
var start = System.clock
|
|
var result = 0
|
|
for (i in 1..1000000) {
|
|
result = result + Benchmark.arguments(1, 2, 3, 4)
|
|
result = result + Benchmark.arguments(1, 2, 3, 4)
|
|
result = result + Benchmark.arguments(1, 2, 3, 4)
|
|
result = result + Benchmark.arguments(1, 2, 3, 4)
|
|
result = result + Benchmark.arguments(1, 2, 3, 4)
|
|
result = result + Benchmark.arguments(1, 2, 3, 4)
|
|
result = result + Benchmark.arguments(1, 2, 3, 4)
|
|
result = result + Benchmark.arguments(1, 2, 3, 4)
|
|
result = result + Benchmark.arguments(1, 2, 3, 4)
|
|
result = result + Benchmark.arguments(1, 2, 3, 4)
|
|
}
|
|
System.print(result)
|
|
System.print("elapsed: %(System.clock - start)")
|