Performance degradation when switching from 8.1 to 8.10 version
I have created simple java application covering standard library operations, translated it with both versions and noticed that 8.10 version works visibly slower. The application covers:
- List operations - add, remove
- Set operations - add, remove
- String and StringBuilder operations - append, substring, deleteCharAt
- System.identityHashCode() method
Results(miliseconds):
JAVA List: 1426 Set: 1206 String: 15009 Identity: 2075 ALL: 19718
.NET IKVM 8.1 List: 6978 Set: 5339 String: 29609 Identity: 2730 ALL: 44657
.NET IKVM 8.10 List: 9385 (+34% comparing to 8.1 version) Set: 11611 (+117%) String: 66506 (+125%) Identity: 18215 (+567%) ALL: 105718 (+137%)
As I am aware of time degradation after translating jar into dll, it seems there is big difference after version update.
I can't say anything about this without access to the benchmarks and methodology.
Steps to recreate:
- Create simple java project with one class(attached IkvmTest.java)
- Run attached a.sh script to create java jar and translate it into dlls(paths in script have to be updated)
- Create .NET solution with two projects, each of them referencing different dll. Add attached Program.cs file to both projects and run it.
So the biggest difference seems to be the System.identityHashCode implementation. In one of the passes to rely more fully on OpenJDK, it was changed back to it's default implementation, which is in native code in libjvm. That means a JNI entry/exit. So, it appears pretty high in the results of a profiler.
I made an adjustmnet to the 'develop' branch which should eliminate that.
Not sure there's much else though. The biggest hit is StringBuilder.deleteCharAt. That method involves a char[] array copy. It looks completely inlined, though, so it should just be a Buffer.BlockCopy. Which is the same as it was back in 8.1.
My biggest question and concern is about changes between 8.1 and 8.10 versions. It seems that almost everything(e.g. simple Set add / remove) works more than 2 times slower, so probably it is not the issue of fixing one / couple of methods. Do you have any idea what could cause such performance degradation?
Oh. No idea. Why don't you profile it?
Additional analysis have shown that this performance degradation occurred between 8.1 and 8.2 versions, and next releases are pretty stable. Also, I was not able to narrow it down to any subset of methods which work slower - profiler says that pretty much every method called works slower than in 8.1.