Hacker News new | ask | show | jobs
by zaarn 2548 days ago
I don't think that is measured correctly: A CPU at 5GHz would take 0.2ns per cycle, how is it supposed to generate 1 billion (!) numbers in only 100x the time? Even if you had 64c/128t threadrippers in a dualsocket and this workload perfectly distributed, you'd only get within 100'000x the time of a single cycle. There's still a factor of 10'000 left.

You might want to try this one:

  np.random.normal(size=1000000000)
For size=1000 I get on my machine about 36 ns per number (total 36 µsecs). You probably measured for size=1 but a normal of 1 billion, not 1 billion numbers at a normal of 1.