« Adding Groovy to the Bubble Sort Performance Race | Main | Broken FC4 ruby-1.8.3 rpm (and how to fix it) »

Groovy Bubble Sort -- Revised

Couple of days ago I posted the performance numbers for Groovy Bubble Sort contirubted by Graeme Sutherland, with a note that the code may not be optimized for performance. And sure enough, one of the commenters, Guillaume Laforge, pointed out that the program used List where String array is more appropriate. He also posted (and e-mailed me) a modified version of the program. Note: The one appearing as comment to the last post has certain characters missing and doesn't compile.

I ran this program on my box and noted down the numbers. As Guillaume reported, his version did the sorting almost 40% faster. However, the performance of generation of random strings didn't improve (quite understandably!). However, what I found really intriguing is that the compiled code ran noticeably slower than the interpreted mode this time, as you can see in the following table:

No. of stringsnum: 1000num: 5000num: 10000
Programgen.sortgen.sortgen.sort
bsort w/ List (interpreted) 3004800 800118000 1345469000
bsort w/ List (compiled) 3004700 840117000 1400465000
bsort w/ String[] (interpreted) 2653050 73574580 1360290400
bsort w/ String[] (compiled) 3303375 89086800 1560352600

Can somebody explain this?

Comments (1)

It's the first time i ran through your site and I found it very informative and interesting. Nicely done! thins that excited you at 14: http://www.yahoo.co.uk , think that will make relief , substances that cure you

About

This page contains a single entry from the blog posted on October 14, 2005 7:25 PM.

The previous post in this blog was Adding Groovy to the Bubble Sort Performance Race.

The next post in this blog is Broken FC4 ruby-1.8.3 rpm (and how to fix it).

Many more can be found on the main index page or by looking through the archives.

Powered by
Movable Type 3.33