Welcome to my new Blog Home!
And for those of you who made it, this quick tidbit.
Everybody in the JVM business optimizes for long arraycopys/memcpy.
You can get peak bandwidth on machines with a decently long memcpy.
It’s easy enough to do and arraycopy and memcpy are called a lot.
But what about short arraycopies? How often do we call System.arraycopy with small numbers?
In a run of JBB2000 (yah, the old one – I happen to have numbers handy for it), how many times a second is System.arraycopy called? Yes, the answer obviously depends on your score. Lets assume your score is middlin’-high – say 1,000,000 BOPs/sec.
Did you guess 30million times/sec? That’s 30 calls to System.arraycopy per BOP on average.
Now, how many bytes are moved on average? – 42.5
That’s less than an x86 cache-line.
Getting a good score on JBB (and on many many benchmarks) depends on getting the overhead of short arraycopies reduced as much as possible. Yes, in the end you need to do well on the rare 1Megabyte array copy… but it’s more important to copy those first few bytes with as little overhead as possible.
PS – We’re working on the RSS feed