Hi,
On 09.12.2014 22:28, Vladimir Ozerov wrote:
> I tested several other scenarios in a similar way and got slowdown in
> all of them. E.g. in another case I got 1.5mcs when method is called
> from Java (confirmed by JMH) and 3mcs when the same method is called
> from JNI.
I have a gut feeling this has something to do with optimizeability of
the target Java method. The methods called from JNI would not be inlined
by HotSpot, the devirtualization would not happen, etc. etc. etc.
> Both cases were tested with the same JDK (1.7.0_33) and the same flags,
> all set to default. Profiling with Mission Control didn't show anything
> suspicious except of the fact that GC were called a little bit less
> frequently in native benchmark.
If "1.5mcs" stands for "1.5 microseconds", no wonder the
application-level profilers show nothing.
> Could you please give me some hints how to investigate this further?
> Could it be a problem with JIT? GC? Safepoints? Etc.
Since you already have JMH benchmarks for these, it would be helpful to
see the result of "-prof perfasm" for both approaches. I have never
looked at JNI transitions under perfasm, so dragons be there.
Thanks,
-Aleksey.