Print time taken in demo

This commit is contained in:
bloeys
2022-11-05 01:17:42 +04:00
parent b40ae1fe3d
commit 2d7d1ae923

View File

@ -12,11 +12,14 @@ func runDemo() {
c := cogo.New(test, 0) c := cogo.New(test, 0)
ticks := 1 ticks := 1
start := time.Now()
for done := c.Tick(); !done; done = c.Tick() { for done := c.Tick(); !done; done = c.Tick() {
println("Ticks done:", ticks, "; Output:", c.Out, "\n") println("Ticks done:", ticks, "; Output:", c.Out, "\n")
ticks++ ticks++
time.Sleep(1 * time.Millisecond) time.Sleep(1 * time.Millisecond)
} }
println("Time taken:", time.Since(start).String())
} }
func test(c *cogo.Coroutine[int, int]) { func test(c *cogo.Coroutine[int, int]) {