java performance Windows vs Linux

java, linux, performance, windows

Solution

Unless you are comparing Linux and Windows XP on the same machine it is very hard to say what the difference is. It could be that while the CPU is faster, the GFX card and disk subsystem is slower.

Java passes all of this IO and GFX acitvity to the underlying OS and the only thing you can do differently is to do less work or work more efficiently. This is likely to make both systems faster, as there is not particular to one OS which you can tune.

Problem

I have developed a Java application that normally run on Linux. It's a POJO application with Swing. Performance is reasonably good. Now I tried to run it on Windows XP with 2Gb RAM, in a machine with similar or greater potency, and performance is much worse. I observe that it uses 100% CPU. For example: - A process that creates a window very heavy, with many components: Linux 5 seconds, Windows 12. A process that accesses a PostgreSQL DB with a heavy query (the server and the JDBC driver are the same): 23 seconds Linux, Windows 43. I tried also with a virtualized Windows machine with similar features, and the result is significantly better! Is it normal? What parameters can I assign to improve performance?

Original source