feat: move OS.clock to IO.clock and remove deprecated os_clock native

Migrate the clock timing functionality from the OS class to the IO class across all benchmark scripts and the core library. Remove the os_clock native function and its associated OS class definition from wren_core.c, while adding a new ioClock native in wren_io.c that uses the same clock()/CLOCKS_PER_SEC logic. Update all benchmark files (binary_trees, fib, for, method_call) to reference IO.clock instead of OS.clock for both start time and elapsed time calculations.
This commit is contained in:
Bob Nystrom
2014-02-04 16:49:16 +00:00
parent 15958938f4
commit dbf0131776
6 changed files with 17 additions and 20 deletions
+2 -2
View File
@@ -24,7 +24,7 @@ var minDepth = 4
var maxDepth = 12
var stretchDepth = maxDepth + 1
var start = OS.clock
var start = IO.clock
IO.print("stretch tree of depth " + stretchDepth.toString + " check: " +
new Tree(0, stretchDepth).check.toString)
@@ -53,4 +53,4 @@ while (depth < stretchDepth) {
IO.print("long lived tree of depth " + maxDepth.toString + " check: " +
longLivedTree.check.toString)
IO.print("elapsed: " + (OS.clock - start).toString)
IO.print("elapsed: " + (IO.clock - start).toString)
+2 -2
View File
@@ -3,8 +3,8 @@ var fib = fn(n) {
return fib.call(n - 1) + fib.call(n - 2)
}
var start = OS.clock
var start = IO.clock
for (i in 1..5) {
IO.print(fib.call(28))
}
IO.print("elapsed: " + (OS.clock - start).toString)
IO.print("elapsed: " + (IO.clock - start).toString)
+2 -2
View File
@@ -1,10 +1,10 @@
var list = []
var start = OS.clock
var start = IO.clock
for (i in 0...1000000) list.add(i)
var sum = 0
for (i in list) sum = sum + i
IO.print(sum)
IO.print("elapsed: " + (OS.clock - start).toString)
IO.print("elapsed: " + (IO.clock - start).toString)
+2 -2
View File
@@ -28,7 +28,7 @@ class NthToggle is Toggle {
}
}
var start = OS.clock
var start = IO.clock
var n = 100000
var val = true
var toggle = new Toggle(val)
@@ -66,4 +66,4 @@ for (i in 0...n) {
IO.print(ntoggle.value)
IO.print("elapsed: " + (OS.clock - start).toString)
IO.print("elapsed: " + (IO.clock - start).toString)