Range operators!
Added ".." and "..." infix operators. Num implements them to
return Range objects. Those in turn implement the iterator
protocol, so now numeric for loops are easy:
for (i in 1..10) { ... }
I also cleaned up the Wren benchmarks to use this.
In the process, I discovered the method_call benchmark really
just showed loop peformance, so I unrolled the loops in all of
the languages to stress method calls.
This commit is contained in:
+1
-7
@@ -1,12 +1,6 @@
|
||||
var list = []
|
||||
|
||||
{
|
||||
var i = 0
|
||||
while (i < 2000000) {
|
||||
list.add(i)
|
||||
i = i + 1
|
||||
}
|
||||
}
|
||||
for (i in 0...2000000) list.add(i)
|
||||
|
||||
var start = OS.clock
|
||||
var sum = 0
|
||||
|
||||
Reference in New Issue
Block a user