ReadyTalk/avian — pull request #274 by codespotx (2014-06-04 16:29:39+00:00)
Title: Slowdowns if multiple threads access heap

avian experiences big slowdowns if multiple threads access the heap in parallel.

MemoryRamp.java from the pull request demonstrates the issue: it will create a 10 MB byte array and access every byte in that array, first in a single thread and then with multiple threads in parallel.

openjdk shows the expected behaviour: the test scales with the number of cores:

% java MemoryRamp
Single thread: 16ms
2 threads: 13ms (2.4615384615384617x)
3 threads: 18ms (2.6666666666666665x)
4 threads: 17ms (3.764705882352941x)

avian is slower than openjdk and also degrades further in the multithreaded tests:

% ../build/linux-x86_64/avian-dynamic MemoryRamp
Single thread: 361ms
2 threads: 2885ms (0.25026x)
3 threads: 2827ms (0.383092x)
4 threads: 5958ms (0.242363x)

it doesn't really matter performance-wise if the bytes are read or written in the loop. the array creation alone doesn't show the same slowdown.