<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Revisiting Groovy performance issues</title>
	<atom:link href="http://tiago.org/cc/2008/03/23/revisiting-groovy-performance-issues/feed/" rel="self" type="application/rss+xml" />
	<link>http://tiago.org/cc/2008/03/23/revisiting-groovy-performance-issues/</link>
	<description>Software engineering in a computational biology environment</description>
	<pubDate>Sat, 05 Jul 2008 10:36:06 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: Wo kann ich filme downloaden? Danke</title>
		<link>http://tiago.org/cc/2008/03/23/revisiting-groovy-performance-issues/#comment-147</link>
		<dc:creator>Wo kann ich filme downloaden? Danke</dc:creator>
		<pubDate>Wed, 02 Jul 2008 17:54:36 +0000</pubDate>
		<guid isPermaLink="false">http://tiago.org/cc/2008/03/23/revisiting-groovy-performance-issues/#comment-147</guid>
		<description>&lt;strong&gt;super bollywood filme downloaden...&lt;/strong&gt;

Wo kann ich filme downloaden?...</description>
		<content:encoded><![CDATA[<p><strong>super bollywood filme downloaden&#8230;</strong></p>
<p>Wo kann ich filme downloaden?&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Luis</title>
		<link>http://tiago.org/cc/2008/03/23/revisiting-groovy-performance-issues/#comment-22</link>
		<dc:creator>Luis</dc:creator>
		<pubDate>Thu, 27 Mar 2008 21:40:52 +0000</pubDate>
		<guid isPermaLink="false">http://tiago.org/cc/2008/03/23/revisiting-groovy-performance-issues/#comment-22</guid>
		<description>Good work !. I have some insights regarding JVMs. A round of test (Windows XP, Core2Duo 2GHz, 2GB RAM) showed the following:

Java (Sun 1.6.0_03-b05): 384 sec
Java (JRockit 1.5.0_10): 327 sec

Groovy (Sun 1.6.0_03-b05): 10549 sec
Groovy (JRockit 1.5.0_10):  6375 sec

The ratios:
With Sun 1.6.0_03-b05: 1:27
With JRockit 1.5.0_10: 1:19

Ergo, I prefer JRockit over Sun JVM for groovy development.</description>
		<content:encoded><![CDATA[<p>Good work !. I have some insights regarding JVMs. A round of test (Windows XP, Core2Duo 2GHz, 2GB RAM) showed the following:</p>
<p>Java (Sun 1.6.0_03-b05): 384 sec<br />
Java (JRockit 1.5.0_10): 327 sec</p>
<p>Groovy (Sun 1.6.0_03-b05): 10549 sec<br />
Groovy (JRockit 1.5.0_10):  6375 sec</p>
<p>The ratios:<br />
With Sun 1.6.0_03-b05: 1:27<br />
With JRockit 1.5.0_10: 1:19</p>
<p>Ergo, I prefer JRockit over Sun JVM for groovy development.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Is Groovy 60 Times Slower than Java? &#171; IT Pearls</title>
		<link>http://tiago.org/cc/2008/03/23/revisiting-groovy-performance-issues/#comment-20</link>
		<dc:creator>Is Groovy 60 Times Slower than Java? &#171; IT Pearls</dc:creator>
		<pubDate>Thu, 27 Mar 2008 03:13:09 +0000</pubDate>
		<guid isPermaLink="false">http://tiago.org/cc/2008/03/23/revisiting-groovy-performance-issues/#comment-20</guid>
		<description>[...] Groovy 60 Times Slower than&#160;Java?  In a pair of very intriguing postings (here and here), Tiago details what he has been observing about the comparative performance of Groovy and [...]</description>
		<content:encoded><![CDATA[<p>[...] Groovy 60 Times Slower than&nbsp;Java?  In a pair of very intriguing postings (here and here), Tiago details what he has been observing about the comparative performance of Groovy and [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tiago</title>
		<link>http://tiago.org/cc/2008/03/23/revisiting-groovy-performance-issues/#comment-19</link>
		<dc:creator>tiago</dc:creator>
		<pubDate>Tue, 25 Mar 2008 23:45:23 +0000</pubDate>
		<guid isPermaLink="false">http://tiago.org/cc/2008/03/23/revisiting-groovy-performance-issues/#comment-19</guid>
		<description>It is actually not a sort, but filling up half of a matrix. So I don't think the bubble/quick sort argument applies.

Also, if it were a complexity problem, the Java version should suffer equally (albeit with a - large - constant difference to the O() case compared to Groovy)</description>
		<content:encoded><![CDATA[<p>It is actually not a sort, but filling up half of a matrix. So I don&#8217;t think the bubble/quick sort argument applies.</p>
<p>Also, if it were a complexity problem, the Java version should suffer equally (albeit with a - large - constant difference to the O() case compared to Groovy)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Darryl Staflund</title>
		<link>http://tiago.org/cc/2008/03/23/revisiting-groovy-performance-issues/#comment-17</link>
		<dc:creator>Darryl Staflund</dc:creator>
		<pubDate>Tue, 25 Mar 2008 20:06:57 +0000</pubDate>
		<guid isPermaLink="false">http://tiago.org/cc/2008/03/23/revisiting-groovy-performance-issues/#comment-17</guid>
		<description>Hi there,

The code specified in your initial posting incorporates a bubble-sort algorithm which has a performance factor of Q(n^2) -- not too good, especially as n (the number of elements to be sorted) increases.  If n = 10 million, your code will loop 10 million ^ 2 times, or approximately, 10,000,000,000,000 times.

Your code will perform a lot better if you incorporate a quick-sort algorithm instead, since its performance factor is Q(n log n).  If n = 10 million, your code will loop (10 million) (log 10 million), or approximately, 70,000,000 times -- a vast improvement!

Bubble sorts have the following structure:

    procedure bubbleSort( A : list of sortable items ) defined as:
      do
        swapped := false
        for each i in 0 to length( A ) - 2 do:
          if A[ i ] &#62; A[ i + 1 ] then
            swap( A[ i ], A[ i + 1 ] )
            swapped := true
          end if
        end for
      while swapped
    end procedure


Quicksorts, on the other hand, have the following structure:

   function quicksort(array)
       var list less, equal, greater
       if length(array) ? 1  
           return array  
       select a pivot value pivot from array
       for each x in array
           if x  pivot then append x to greater
       return concatenate(quicksort(less), equal, quicksort(greater))

The other recommendations to this post are all valid, but its the algorithm itself that is your bottleneck.  Hope this helps.

Darryl</description>
		<content:encoded><![CDATA[<p>Hi there,</p>
<p>The code specified in your initial posting incorporates a bubble-sort algorithm which has a performance factor of Q(n^2) &#8212; not too good, especially as n (the number of elements to be sorted) increases.  If n = 10 million, your code will loop 10 million ^ 2 times, or approximately, 10,000,000,000,000 times.</p>
<p>Your code will perform a lot better if you incorporate a quick-sort algorithm instead, since its performance factor is Q(n log n).  If n = 10 million, your code will loop (10 million) (log 10 million), or approximately, 70,000,000 times &#8212; a vast improvement!</p>
<p>Bubble sorts have the following structure:</p>
<p>    procedure bubbleSort( A : list of sortable items ) defined as:<br />
      do<br />
        swapped := false<br />
        for each i in 0 to length( A ) - 2 do:<br />
          if A[ i ] &gt; A[ i + 1 ] then<br />
            swap( A[ i ], A[ i + 1 ] )<br />
            swapped := true<br />
          end if<br />
        end for<br />
      while swapped<br />
    end procedure</p>
<p>Quicksorts, on the other hand, have the following structure:</p>
<p>   function quicksort(array)<br />
       var list less, equal, greater<br />
       if length(array) ? 1<br />
           return array<br />
       select a pivot value pivot from array<br />
       for each x in array<br />
           if x  pivot then append x to greater<br />
       return concatenate(quicksort(less), equal, quicksort(greater))</p>
<p>The other recommendations to this post are all valid, but its the algorithm itself that is your bottleneck.  Hope this helps.</p>
<p>Darryl</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tiago</title>
		<link>http://tiago.org/cc/2008/03/23/revisiting-groovy-performance-issues/#comment-15</link>
		<dc:creator>tiago</dc:creator>
		<pubDate>Mon, 24 Mar 2008 11:53:55 +0000</pubDate>
		<guid isPermaLink="false">http://tiago.org/cc/2008/03/23/revisiting-groovy-performance-issues/#comment-15</guid>
		<description>Graeme,

Data? I can get you all the data you need ;)

I am working with data from the public &lt;a href="http://hapmap.org" rel="nofollow"&gt;HapMap&lt;/a&gt; project.

Any autosome from &lt;a href="ftp://ftp.hapmap.org/pub/hapmap/public/genotypes/latest/fwd_strand/redundant-filtered/" rel="nofollow"&gt;here&lt;/a&gt;, should do fine. I recommend chromosome 22 as it is the smallest autosome (so less data).

&lt;a href="ftp://ftp.hapmap.org/pub/hapmap/public/genotypes/latest/fwd_strand/redundant-filtered/genotypes_chr21_YRI_r23_QC+.b36_fwd.txt.gz" rel="nofollow"&gt;Yoruban 21&lt;/a&gt; - Still one of the smallest, should work directly (change the directory only on the BufferedReader line) with the groovy code (which only processes one chromosome from one population. The Java code does all autosomes of Yorubans and Utahans).</description>
		<content:encoded><![CDATA[<p>Graeme,</p>
<p>Data? I can get you all the data you need <img src='http://tiago.org/cc/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>I am working with data from the public <a href="http://hapmap.org" rel="nofollow">HapMap</a> project.</p>
<p>Any autosome from <a href="ftp://ftp.hapmap.org/pub/hapmap/public/genotypes/latest/fwd_strand/redundant-filtered/" rel="nofollow">here</a>, should do fine. I recommend chromosome 22 as it is the smallest autosome (so less data).</p>
<p><a href="ftp://ftp.hapmap.org/pub/hapmap/public/genotypes/latest/fwd_strand/redundant-filtered/genotypes_chr21_YRI_r23_QC+.b36_fwd.txt.gz" rel="nofollow">Yoruban 21</a> - Still one of the smallest, should work directly (change the directory only on the BufferedReader line) with the groovy code (which only processes one chromosome from one population. The Java code does all autosomes of Yorubans and Utahans).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Graeme Rocher</title>
		<link>http://tiago.org/cc/2008/03/23/revisiting-groovy-performance-issues/#comment-13</link>
		<dc:creator>Graeme Rocher</dc:creator>
		<pubDate>Mon, 24 Mar 2008 11:42:34 +0000</pubDate>
		<guid isPermaLink="false">http://tiago.org/cc/2008/03/23/revisiting-groovy-performance-issues/#comment-13</guid>
		<description>It would be useful if you could post a sample of the data you were using, even if only a subset of it. Otherwise others can't try out the code</description>
		<content:encoded><![CDATA[<p>It would be useful if you could post a sample of the data you were using, even if only a subset of it. Otherwise others can&#8217;t try out the code</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tiago</title>
		<link>http://tiago.org/cc/2008/03/23/revisiting-groovy-performance-issues/#comment-12</link>
		<dc:creator>tiago</dc:creator>
		<pubDate>Mon, 24 Mar 2008 11:34:18 +0000</pubDate>
		<guid isPermaLink="false">http://tiago.org/cc/2008/03/23/revisiting-groovy-performance-issues/#comment-12</guid>
		<description>Hi,

I have put the code &lt;a href="http://tiago.org/groovypost/" rel="nofollow"&gt;here&lt;/a&gt; (Along with the Java version).

I would like to thank everybody that offered to help. I have sorted this out in Java and for me it is a done deal.

But we could use this exercise in order to understand and document possible groovy performance pitfalls. So, if you have any suggestions to enhance the code feel free to comment, so that we can help others in not making the mistakes that I have done.</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>I have put the code <a href="http://tiago.org/groovypost/" rel="nofollow">here</a> (Along with the Java version).</p>
<p>I would like to thank everybody that offered to help. I have sorted this out in Java and for me it is a done deal.</p>
<p>But we could use this exercise in order to understand and document possible groovy performance pitfalls. So, if you have any suggestions to enhance the code feel free to comment, so that we can help others in not making the mistakes that I have done.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sakuraba</title>
		<link>http://tiago.org/cc/2008/03/23/revisiting-groovy-performance-issues/#comment-11</link>
		<dc:creator>Sakuraba</dc:creator>
		<pubDate>Mon, 24 Mar 2008 11:19:32 +0000</pubDate>
		<guid isPermaLink="false">http://tiago.org/cc/2008/03/23/revisiting-groovy-performance-issues/#comment-11</guid>
		<description>Hi!

It was not my intention to criticize code quality or anything like that. I dont write groovy idiomatic code all the time myself. I have looked at some groovy code I wrote a few weeks ago. After having written more and more groovy code I could refactor a lot of the old code and eliminate at least half of the LOC count. It was more readable, too.

I would like to provide suggestions on improvement regarding performance, but I dont understand what you are actually trying to do. Could you post the entire code and not just snippets of it? That would be great.

I am using Groovy at work to load a few hundred database entries with lots of hierarchical relationships, traverse those entries to build a specific collections structure, so it can be converted to a specific JSON format for the view layer.

All of this happens in a few ms not more, so I think we can definetly improve your problem.</description>
		<content:encoded><![CDATA[<p>Hi!</p>
<p>It was not my intention to criticize code quality or anything like that. I dont write groovy idiomatic code all the time myself. I have looked at some groovy code I wrote a few weeks ago. After having written more and more groovy code I could refactor a lot of the old code and eliminate at least half of the LOC count. It was more readable, too.</p>
<p>I would like to provide suggestions on improvement regarding performance, but I dont understand what you are actually trying to do. Could you post the entire code and not just snippets of it? That would be great.</p>
<p>I am using Groovy at work to load a few hundred database entries with lots of hierarchical relationships, traverse those entries to build a specific collections structure, so it can be converted to a specific JSON format for the view layer.</p>
<p>All of this happens in a few ms not more, so I think we can definetly improve your problem.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jim Loverde</title>
		<link>http://tiago.org/cc/2008/03/23/revisiting-groovy-performance-issues/#comment-10</link>
		<dc:creator>Jim Loverde</dc:creator>
		<pubDate>Mon, 24 Mar 2008 08:14:51 +0000</pubDate>
		<guid isPermaLink="false">http://tiago.org/cc/2008/03/23/revisiting-groovy-performance-issues/#comment-10</guid>
		<description>Looks like you can eliminate the "isDifferent" variable by moving the incrementing of the counts value into the if statement.

You can probably also store the iCase[0] and iCase[1] values in variables before the for loop to improve performance comparing to those values.</description>
		<content:encoded><![CDATA[<p>Looks like you can eliminate the &#8220;isDifferent&#8221; variable by moving the incrementing of the counts value into the if statement.</p>
<p>You can probably also store the iCase[0] and iCase[1] values in variables before the for loop to improve performance comparing to those values.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
