Nice shirleyquirk!
I guess I should just use arrays when performance really matters and I know the
size compile time. Would you do it like this?
import sequtils
import random
import times
const
size = 10_000_000
iterations = 100_000_000
type
I am getting even larger difference between sample and rand(size-1) with flto
passed to C
time taken sample: 1.021981
time taken rand: 0.098158
nim c -r -d=danger --passC:-flto --passC:-ffast-math hue.nim
Nim Compiler Version 1.4.4 [MacOSX: amd64]
Hi, I am experiencing that the
[sample](https://nim-lang.org/docs/random.html#sample%2CopenArray%5BT%5D)
function is more than two times slower than manually indexing into rand(size-1):
import sequtils
import random
import times
proc main() =
const