3 ms·
There are some insane performance. I thought memory bandwidth was a limitation, to move 2~4TB data through memory. Then saw it was a cross join of 1M numbers
by ww520 10y ago
There are some insane performance. I thought memory bandwidth was a limitation, to move 2~4TB data through memory. Then saw it was a cross join of 1M numbers X 1M numbers. 1 million of 4-byte int is just 4MB, which can fit comfortably in the L1/L2/L3 caches. And the output of the 1M x 1M cross join is thrown away; just a counter is incremented. So no 1T results were pushed through the memory.
A cross join is just two nested loops iterating over one array over another. With 40 cores, each handles 25 billions iterations of the 1 trillion. Assuming each iteration takes 10 CPU cycles, a 6GHZ core can handle 600M iterations/second. 25B / 600M = 41 seconds to run the whole thing.
Yes, 1 second is too fast.
Awesome that they figured it out it's the JVM optimized out the no-side effect computation.