This commit results in significant increase of subscriber's performance
in Java.
Previously we used to create many Java objects during the reception of fresh
issue. These objects carried the same information as the ORTERecvInfo C
structure. Now we handle it in a way similar to how data reception is taken
care of.
That is, we allocate a direct ByteBuffer upon the creation of subscriber.
This buffer's address is then stored in a helper structure, which is passed
to this receive callback function.
When new issue arrives, we copy it's ORTERecvInfo C structure into this
ByteBuffer by calling memcpy(). We are not immediately parsing the contents
of this buffer for performance reasons. We do it only when someone
requests information included in the buffer (this is handled in the
org.ocera.orte.types.RecvInfo class).
Many method IDs and field IDs previously looked-up upon every callback
invocation are now cached in a helper structure, since the IDs remain
valid until the mentioned classes are unloaded by the ClassLoader
(that is until all their instances are GC'd). Also many unnecessary checks
are removed from the receive callback. This patch increases the probability,
that the callback function remains in the I-cache, because many procedures
are moved away.
Performance comparison before and after applying this patch:
(Reception of 10,000 issues)
PC, Intel C2Q Q9550 @ 2GHz, OpenJDK 7
Before: 2.01 s
Now: 1.68 s
SE Xperia Ray, Android 4.1
Before (Thumb): 10.95 s
Before (ARM): 10.90 s
Now (Thumb): 9.43 s
Now (ARM): 9.53 s
As could be seen the Thumb-2 mode outperforms the ARM mode, so there is now
no need to switch to the ARM mode.