mirror of
https://github.com/wren-lang/wren.git
synced 2026-01-11 22:28:45 +01:00
17 lines
320 B
Plaintext
17 lines
320 B
Plaintext
// Creates 10000 fibers. Each one calls the next in a chain until the last.
|
|
var fibers = []
|
|
var sum = 0
|
|
|
|
var start = System.clock
|
|
|
|
for (i in 0...100000) {
|
|
fibers.add(Fiber.new {
|
|
sum = sum + i
|
|
if (i < 99999) fibers[i + 1]()
|
|
})
|
|
}
|
|
|
|
fibers[0]()
|
|
System.print(sum)
|
|
System.print("elapsed: %(System.clock - start)")
|