Quick actions

cmd+k|ctrl+k

Navigation

Languages

Untitled

Snippet info

Language

Nim

Visibility

unlisted

Author

legacy-anonymous

Created

2017-05-06T15:50:31Z

Updated

2017-05-06T15:50:31Z

import times, random

const TOTAL = 10_000_000
var s = newSeq[int](TOTAL)

for i in mitems s:
  i = random(10)

template test1 =
  {.checks:off.}
  let t1 = cpuTime()
  var count = 0

  for i in s:
    count += i

  echo count, ": ", cpuTime() - t1

test1()
test1()
test1()
{.checks:off.}
test1()
test1()

  
INFO