<?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"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Groovy: Cool but slow</title>
	<atom:link href="http://www.shaunabram.com/groovy-slow/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.shaunabram.com/groovy-slow/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=groovy-slow</link>
	<description>Java and Technology weblog</description>
	<lastBuildDate>Sun, 05 Feb 2012 22:00:46 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: admin</title>
		<link>http://www.shaunabram.com/groovy-slow/comment-page-1/#comment-9567</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Thu, 12 Nov 2009 06:50:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.shaunabram.com/?p=576#comment-9567</guid>
		<description>Josh,
Thanks for the comments. I stand by my post and I think IDE support for Groovy has still a long way to come before matching Java - my benchmark, as unfair as that may be. But I think we can definitely agree that great progress is being made.
There was an interesting article on Groovy Eclipse work from Spring a ago (http://groovy.dzone.com/news/interview-meet-groovy-eclipse).

Shaun</description>
		<content:encoded><![CDATA[<p>Josh,<br />
Thanks for the comments. I stand by my post and I think IDE support for Groovy has still a long way to come before matching Java &#8211; my benchmark, as unfair as that may be. But I think we can definitely agree that great progress is being made.<br />
There was an interesting article on Groovy Eclipse work from Spring a ago (<a href="http://groovy.dzone.com/news/interview-meet-groovy-eclipse" rel="nofollow">http://groovy.dzone.com/news/interview-meet-groovy-eclipse</a>).</p>
<p>Shaun</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Josh Brown</title>
		<link>http://www.shaunabram.com/groovy-slow/comment-page-1/#comment-9564</link>
		<dc:creator>Josh Brown</dc:creator>
		<pubDate>Wed, 11 Nov 2009 14:34:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.shaunabram.com/?p=576#comment-9564</guid>
		<description>For the record, IDE support for Groovy is not poor.  The article linked is from 2008/01/23, and it may have been poor at that time, but IDE support has greatly improved since then.  From my experience in Groovy development over the past year, support for it in IntelliJ IDEA is excellent, including code completion and debugging support.  I&#039;ve also heard that SpringSource&#039;s STS has good support for Groovy, but haven&#039;t used it myself.</description>
		<content:encoded><![CDATA[<p>For the record, IDE support for Groovy is not poor.  The article linked is from 2008/01/23, and it may have been poor at that time, but IDE support has greatly improved since then.  From my experience in Groovy development over the past year, support for it in IntelliJ IDEA is excellent, including code completion and debugging support.  I&#8217;ve also heard that SpringSource&#8217;s STS has good support for Groovy, but haven&#8217;t used it myself.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Simon Polak</title>
		<link>http://www.shaunabram.com/groovy-slow/comment-page-1/#comment-9543</link>
		<dc:creator>Simon Polak</dc:creator>
		<pubDate>Thu, 05 Nov 2009 03:57:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.shaunabram.com/?p=576#comment-9543</guid>
		<description>You should also use Long in java version of this test, since groovy doesn&#039;t have primitives.</description>
		<content:encoded><![CDATA[<p>You should also use Long in java version of this test, since groovy doesn&#8217;t have primitives.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James Wiltshire</title>
		<link>http://www.shaunabram.com/groovy-slow/comment-page-1/#comment-8495</link>
		<dc:creator>James Wiltshire</dc:creator>
		<pubDate>Fri, 14 Aug 2009 10:01:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.shaunabram.com/?p=576#comment-8495</guid>
		<description>Hey - I&#039;m a big fan of Groovy too and especially Grails, which I&#039;ve been using for some pet projects.
Was intrigued by your results - I also expect something like Groovy to be slower than the Java equivalent, which is the price you have to pay for the syntactical niceness the dynamic language brings you, but was surprised at how slow you found things. I guess any tests like this are always going to be subjective, and with something like Grails you do have the option of falling back to Java for any areas that are proving to be performance bottlenecks in your running app.

Tried a few tests myself, and with a few tweaks, the results end up being a lot closer:
1. modify your test so that there is some activity within the loop (just instantiating an empty String) 
2. Run your test loop multiple times and discard the timings of the first few runs - whenever we run performance tests for a production webapp we always give the JVM a chance to &#039;warm up&#039; before starting the test statistics, thereby giving the JVM a chance to work its internal optimzation magic. 
3. Run with a 1.6 rather than a 1.5 JVM (I note that you&#039;re already doing this, but initially  I wasn&#039;t and it made a massive impact to the Groovy timings). This gave about a 50x perf boost to the Groovy test for me!

Now running the tests, the Java version took ~30ms and the Groovy version took ~70ms

For the record, here are the Groovy and Java versions I&#039;m using
monaco:Temp james$ groovy -version
Groovy Version: 1.6.4 JVM: 1.6.0_13
monaco:Temp james$ java -version
java version &quot;1.6.0_13&quot;
Java(TM) SE Runtime Environment (build 1.6.0_13-b03-211)
Java HotSpot(TM) 64-Bit Server VM (build 11.3-b02-83, mixed mode)

... and here are the modified test files

for (outer in 1..20){

long max = 1000000;
long start = Calendar.getInstance().getTimeInMillis();
for(int i=0;i&lt;max; i++) {
  String s=new String();
}
long end = Calendar.getInstance().getTimeInMillis();
long duration = end - start;
println(duration);

}


... and Java...

import java.util.*;
public class Test{

public static void main(String[] args){
for (int outer=1; outer&lt;20; outer++){

long max = 1000000;
long start = Calendar.getInstance().getTimeInMillis();
for(int i=0;i&lt;max; i++) {
  String s=new String();
}
//for (i in 1..max){}
long end = Calendar.getInstance().getTimeInMillis();
long duration = end - start;
System.out.println(duration);
		}
	}		
}</description>
		<content:encoded><![CDATA[<p>Hey &#8211; I&#8217;m a big fan of Groovy too and especially Grails, which I&#8217;ve been using for some pet projects.<br />
Was intrigued by your results &#8211; I also expect something like Groovy to be slower than the Java equivalent, which is the price you have to pay for the syntactical niceness the dynamic language brings you, but was surprised at how slow you found things. I guess any tests like this are always going to be subjective, and with something like Grails you do have the option of falling back to Java for any areas that are proving to be performance bottlenecks in your running app.</p>
<p>Tried a few tests myself, and with a few tweaks, the results end up being a lot closer:<br />
1. modify your test so that there is some activity within the loop (just instantiating an empty String)<br />
2. Run your test loop multiple times and discard the timings of the first few runs &#8211; whenever we run performance tests for a production webapp we always give the JVM a chance to &#8216;warm up&#8217; before starting the test statistics, thereby giving the JVM a chance to work its internal optimzation magic.<br />
3. Run with a 1.6 rather than a 1.5 JVM (I note that you&#8217;re already doing this, but initially  I wasn&#8217;t and it made a massive impact to the Groovy timings). This gave about a 50x perf boost to the Groovy test for me!</p>
<p>Now running the tests, the Java version took ~30ms and the Groovy version took ~70ms</p>
<p>For the record, here are the Groovy and Java versions I&#8217;m using<br />
monaco:Temp james$ groovy -version<br />
Groovy Version: 1.6.4 JVM: 1.6.0_13<br />
monaco:Temp james$ java -version<br />
java version &#8220;1.6.0_13&#8243;<br />
Java(TM) SE Runtime Environment (build 1.6.0_13-b03-211)<br />
Java HotSpot(TM) 64-Bit Server VM (build 11.3-b02-83, mixed mode)</p>
<p>&#8230; and here are the modified test files</p>
<p>for (outer in 1..20){</p>
<p>long max = 1000000;<br />
long start = Calendar.getInstance().getTimeInMillis();<br />
for(int i=0;i&lt;max; i++) {<br />
  String s=new String();<br />
}<br />
long end = Calendar.getInstance().getTimeInMillis();<br />
long duration = end &#8211; start;<br />
println(duration);</p>
<p>}</p>
<p>&#8230; and Java&#8230;</p>
<p>import java.util.*;<br />
public class Test{</p>
<p>public static void main(String[] args){<br />
for (int outer=1; outer&lt;20; outer++){</p>
<p>long max = 1000000;<br />
long start = Calendar.getInstance().getTimeInMillis();<br />
for(int i=0;i&lt;max; i++) {<br />
  String s=new String();<br />
}<br />
//for (i in 1..max){}<br />
long end = Calendar.getInstance().getTimeInMillis();<br />
long duration = end &#8211; start;<br />
System.out.println(duration);<br />
		}<br />
	}<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ignacio Coloma</title>
		<link>http://www.shaunabram.com/groovy-slow/comment-page-1/#comment-8484</link>
		<dc:creator>Ignacio Coloma</dc:creator>
		<pubDate>Thu, 13 Aug 2009 13:54:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.shaunabram.com/?p=576#comment-8484</guid>
		<description>You should actually do something in your loop to stop the influence of micro optimizations performed by the compiler.</description>
		<content:encoded><![CDATA[<p>You should actually do something in your loop to stop the influence of micro optimizations performed by the compiler.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

