KBD

Keith Devens .com

Friday, September 5, 2008 Flag waving
Any sufficiently complicated C or Fortran program contains an ad hoc, informally specified, bug-ridden, slow implementation of half of... – Philip Greenspun (Greenspun's Tenth Rule)

Archive: July 22, 2005

← July 21, 2005July 24, 2005 →

Daily link icon Friday, July 22, 2005

Pents90: Java Port of C++ Algorithm Performs Better with No Optimization

Pents90: Java Port of C++ Algorithm Performs Better with No Optimization:

With no attempts to optimize the Java version, it ran 1.2x faster than the C++ version. After some simple optimization of the inner loop in Java, this increased to 1.5x. The nature of the algorithm was a lot of array accesses and floating point arithmetic. In particular, there is an n-dimensional Euclidean distance calculation that takes up the majority of the running time.

We ran our Sun 1.5 JVM on Windows with the -server flag on. With the -server flag off, Java performed quite poorly: 1.7x slower with no optimizations, 1.1x slower with optimizations of the inner loop. The -server flag, despite its name, is not just for servers. It is a flag that indicates to the VM that it should invest in expensive and complex just-in-time compilations that will pay off in the long run. Typical parameters for our algorithm would result in runtimes from several seconds to a few minutes. So, I recommend that all similarly CPU-intensive software make use of this flag.

The conclusion is that just-in-time compilation really works. We ported an algorithm directly from C++ to Java with no attempts to optimize and experienced a 20% performance improvement.

Why am I just hearing of the -server flag now? Grr!

Matt2000 comments:

What this means is that you shouldn‘t be choosing C++ for performance reasons alone anymore unless you can prove it is a case where something specific about C++ will give it an advantage. More fundamentally, it‘s no longer a valid assumption that statically compiled native code will execute faster than an advanced JIT compiler will run it. In fact it‘s probably a better assumption from now on to assume that the static compiler will underperform the dymanic one.

  1. CIA - The World Factbook: Cross-Reference List of Country Data Codes. Lists both ISO 3166 and FIPS 10-4.

       (0)
← July 21, 2005July 24, 2005 →
September 2008
SunMonTueWedThuFriSat
 123456
78910111213
14151617181920
21222324252627
282930 



RSS feed RSS feed for Keith's Weblog
Atom feed Atom feed for Keith's Weblog
Weblog archive
Recent comments
  on 5 posts

Recent comments XML

new⇒I hate ASP.NET

CF, why pick that piece of trash?​Cold Confusion. Is it finally​really a OO...

ColdConfusion: Sep 5, 8:36pm

new⇒Maps of Iraq

This is for Linda, I will be​visiting that site some time in the​near futur...

Bob: Sep 5, 1:20pm

Girls, please don't get breast implants

Well alright I just read my above​comment and I wanted to add​this...I shou...

76.66.140.8: Sep 4, 7:31pm

Spider solitaire

I don't think the question was​necessarily if there are unbeatable​games.  ...

Jared: Sep 4, 12:44pm

Convert Pantone Colors to RGB and Hex - Color Conversion Chart

The colors on those website don't​seem to relate to the pantone data​we hav...

blah: Sep 3, 10:12am

Generated in about 0.052s.

(Used 7 db queries)

mobile phone