1
0
forked from Mirror/wren

Add a benchmark to test the Wren C API.

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.
This commit is contained in:
Bob Nystrom
2015-12-15 16:02:13 -08:00
parent 873926915f
commit 01e8f9053e
16 changed files with 118 additions and 60 deletions

View File

@ -0,0 +1,20 @@
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)")