System.arraycopy() speed

I microbenchmarked System.arraycopy() on a bunch of different processors, and to my surprise Core.i5/i7 processors give a throughput 5 or 6 times higher than a Core 2 Duo. It can’t be the difference between DDR2 and DDR3 memory, so I’m wondering if the native code might use some instruction set not available on older processors. Any ideas?

Not the instruction sets but very much based on the speeds and sizes of the L1/L2/L3 caches, the bus speed, and the speed of the RAM.
Try some more varied benchmarks (sizes, alignments, randomness).

Cas :slight_smile:

I vary the array size from approx 500 bytes to 32MB. I can see changes that relate directly to the size of the caches (performance drops by a bit when the array is larger than the cache size), but the huge 5x factor applies across the range of array sizes.

Not sure what you mean by alignment? Good or evil? :slight_smile: