<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/'><id>tag:blogger.com,1999:blog-24611184.post2185089654685169536..comments</id><updated>2010-02-06T18:20:29.770-08:00</updated><category term='xml'/><category term='scala'/><category term='podcast'/><category term='StAX'/><category term='java'/><category term='programming'/><category term='jdo'/><category term='socialnetworks'/><category term='gwt'/><category term='monitoring'/><category term='open source'/><category term='Thrift'/><category term='linkedin'/><category term='javaposse'/><category term='protobuf'/><category term='Google App Engine'/><category term='test'/><category term='guic'/><category term='guice'/><category term='ibm'/><category term='groovy'/><category term='spring'/><category term='twitter'/><category term='OHF'/><category term='Eclipse'/><category term='Mac'/><category term='voldemort'/><category term='kaching'/><category term='testing'/><category term='j2ee'/><category term='work'/><category term='conferences'/><category term='xstream'/><category term='json'/><category term='Books'/><title type='text'>Comments on Wondering around: Microbenchmarking Scala vs Java</title><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://www.eishay.com/feeds/2185089654685169536/comments/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/24611184/2185089654685169536/comments/default'/><link rel='alternate' type='text/html' href='http://www.eishay.com/2009/07/microbenchmarking-scala-vs-java.html'/><author><name>Eishay Smith</name><uri>http://www.blogger.com/profile/09443096006184006852</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://4.bp.blogspot.com/_O9TJAb-LjDE/S44K61181wI/AAAAAAAAAj0/oYGO2xz_kf4/S220/eishay.png'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>11</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-24611184.post-8556240319618518030</id><published>2010-02-06T18:20:29.770-08:00</published><updated>2010-02-06T18:20:29.770-08:00</updated><title type='text'>Can you compare it with machine code?

I always wo...</title><content type='html'>Can you compare it with machine code?&lt;br /&gt;&lt;br /&gt;I always wonder if I programmed it in assembly, if it would be very much faster or not.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/24611184/2185089654685169536/comments/default/8556240319618518030'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/24611184/2185089654685169536/comments/default/8556240319618518030'/><link rel='alternate' type='text/html' href='http://www.eishay.com/2009/07/microbenchmarking-scala-vs-java.html?showComment=1265509229770#c8556240319618518030' title=''/><author><name>phil</name><uri>http://www.blogger.com/profile/08897011817693913795</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.eishay.com/2009/07/microbenchmarking-scala-vs-java.html' ref='tag:blogger.com,1999:blog-24611184.post-2185089654685169536' source='http://www.blogger.com/feeds/24611184/posts/default/2185089654685169536' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-2124703656'/></entry><entry><id>tag:blogger.com,1999:blog-24611184.post-8589585554138885651</id><published>2009-07-11T23:23:04.896-07:00</published><updated>2009-07-11T23:23:04.896-07:00</updated><title type='text'>Sorry, here is the link: http://blog.objectmentor....</title><content type='html'>Sorry, here is the link: http://blog.objectmentor.com/articles/2009/06/05/bay-area-scala-enthusiasts-base-meeting-whats-new-in-scala-2-8</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/24611184/2185089654685169536/comments/default/8589585554138885651'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/24611184/2185089654685169536/comments/default/8589585554138885651'/><link rel='alternate' type='text/html' href='http://www.eishay.com/2009/07/microbenchmarking-scala-vs-java.html?showComment=1247379784896#c8589585554138885651' title=''/><author><name>Eishay Smith</name><uri>http://www.blogger.com/profile/09443096006184006852</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://2.bp.blogspot.com/_O9TJAb-LjDE/SdlzHG9KSlI/AAAAAAAAAYc/kCnqSgnk0es/S220/n646386018_2207361_5928583.jpg'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.eishay.com/2009/07/microbenchmarking-scala-vs-java.html' ref='tag:blogger.com,1999:blog-24611184.post-2185089654685169536' source='http://www.blogger.com/feeds/24611184/posts/default/2185089654685169536' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1856236024'/></entry><entry><id>tag:blogger.com,1999:blog-24611184.post-2477648858557081712</id><published>2009-07-11T23:21:05.726-07:00</published><updated>2009-07-11T23:21:05.726-07:00</updated><title type='text'>Hi Stefan, check out &lt;a rel="nofollow"&gt;Dean&amp;#39;s ...</title><content type='html'>Hi Stefan, check out &lt;a rel="nofollow"&gt;Dean&amp;#39;s post where he discuss @specialized&lt;/a&gt;.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/24611184/2185089654685169536/comments/default/2477648858557081712'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/24611184/2185089654685169536/comments/default/2477648858557081712'/><link rel='alternate' type='text/html' href='http://www.eishay.com/2009/07/microbenchmarking-scala-vs-java.html?showComment=1247379665726#c2477648858557081712' title=''/><author><name>Eishay Smith</name><uri>http://www.blogger.com/profile/09443096006184006852</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://2.bp.blogspot.com/_O9TJAb-LjDE/SdlzHG9KSlI/AAAAAAAAAYc/kCnqSgnk0es/S220/n646386018_2207361_5928583.jpg'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.eishay.com/2009/07/microbenchmarking-scala-vs-java.html' ref='tag:blogger.com,1999:blog-24611184.post-2185089654685169536' source='http://www.blogger.com/feeds/24611184/posts/default/2185089654685169536' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1856236024'/></entry><entry><id>tag:blogger.com,1999:blog-24611184.post-66901957258105309</id><published>2009-07-06T13:10:41.155-07:00</published><updated>2009-07-06T13:10:41.155-07:00</updated><title type='text'>Is there additional information available regardin...</title><content type='html'>Is there additional information available regarding the @specialized annotation? From what I understand it would have to be used when defining the generic type. Currently I can&amp;#39;t find any usage in the scala 2.8 library. Who can tell more about that interesting thing?&lt;br /&gt;&lt;br /&gt;Yours,&lt;br /&gt;Stefan</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/24611184/2185089654685169536/comments/default/66901957258105309'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/24611184/2185089654685169536/comments/default/66901957258105309'/><link rel='alternate' type='text/html' href='http://www.eishay.com/2009/07/microbenchmarking-scala-vs-java.html?showComment=1246911041155#c66901957258105309' title=''/><author><name>Anonymous</name><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img1.blogblog.com/img/blank.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.eishay.com/2009/07/microbenchmarking-scala-vs-java.html' ref='tag:blogger.com,1999:blog-24611184.post-2185089654685169536' source='http://www.blogger.com/feeds/24611184/posts/default/2185089654685169536' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1071187763'/></entry><entry><id>tag:blogger.com,1999:blog-24611184.post-9093761490750228782</id><published>2009-07-03T23:15:29.318-07:00</published><updated>2009-07-03T23:15:29.318-07:00</updated><title type='text'>You got it Ismael!

Only the last suggestion (the ...</title><content type='html'>You got it Ismael!&lt;br /&gt;&lt;br /&gt;Only the last suggestion (the bug you found) made any difference. After solving it Scala and Java matched up. Actually Scala was 2ms but considering the non-realtime OS, 0.1% performance difference is meaningless. I&amp;#39;ll update the post.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/24611184/2185089654685169536/comments/default/9093761490750228782'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/24611184/2185089654685169536/comments/default/9093761490750228782'/><link rel='alternate' type='text/html' href='http://www.eishay.com/2009/07/microbenchmarking-scala-vs-java.html?showComment=1246688129318#c9093761490750228782' title=''/><author><name>Eishay Smith</name><uri>http://www.blogger.com/profile/09443096006184006852</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://2.bp.blogspot.com/_O9TJAb-LjDE/SdlzHG9KSlI/AAAAAAAAAYc/kCnqSgnk0es/S220/n646386018_2207361_5928583.jpg'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.eishay.com/2009/07/microbenchmarking-scala-vs-java.html' ref='tag:blogger.com,1999:blog-24611184.post-2185089654685169536' source='http://www.blogger.com/feeds/24611184/posts/default/2185089654685169536' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1856236024'/></entry><entry><id>tag:blogger.com,1999:blog-24611184.post-1000322329461369057</id><published>2009-07-03T12:44:10.809-07:00</published><updated>2009-07-03T12:44:10.809-07:00</updated><title type='text'>Eishay,

I understand that while loops are used in...</title><content type='html'>Eishay,&lt;br /&gt;&lt;br /&gt;I understand that while loops are used in this benchmark. That is why I said that specialized would not help.&lt;br /&gt;&lt;br /&gt;What does help is using the same code for both versions. :)&lt;br /&gt;&lt;br /&gt;Here are some suggestions (they make the Scala code closer to the Java one and made Scala&amp;#39;s version faster when I tested):&lt;br /&gt;&lt;br /&gt;- Replace the inner methods with normal ones.&lt;br /&gt;&lt;br /&gt;- Change Scala&amp;#39;s version to use a class instead of object and create an object that simply creates the class and calls main on it.&lt;br /&gt;&lt;br /&gt;- The line that starts with &amp;quot;if (j &amp;lt; r)&amp;quot; is different from the Java code. The Java code is &amp;quot;if (R &amp;gt; i)&amp;quot;.&lt;br /&gt;&lt;br /&gt;Does that make any difference?&lt;br /&gt;&lt;br /&gt;Ismael</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/24611184/2185089654685169536/comments/default/1000322329461369057'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/24611184/2185089654685169536/comments/default/1000322329461369057'/><link rel='alternate' type='text/html' href='http://www.eishay.com/2009/07/microbenchmarking-scala-vs-java.html?showComment=1246650250809#c1000322329461369057' title=''/><author><name>Ismael Juma</name><uri>http://www.blogger.com/profile/17398483226873559286</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.eishay.com/2009/07/microbenchmarking-scala-vs-java.html' ref='tag:blogger.com,1999:blog-24611184.post-2185089654685169536' source='http://www.blogger.com/feeds/24611184/posts/default/2185089654685169536' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-2084065487'/></entry><entry><id>tag:blogger.com,1999:blog-24611184.post-8869367566524633979</id><published>2009-07-03T10:58:27.623-07:00</published><updated>2009-07-03T10:58:27.623-07:00</updated><title type='text'>But Ismael, the Scala code in the example does use...</title><content type='html'>But Ismael, the Scala code in the example does use a while loop (compiled down to a for loop). &lt;br /&gt;I&amp;#39;m trying to change the Scala code to close the performance gap between it and the Java code. Any ideas?</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/24611184/2185089654685169536/comments/default/8869367566524633979'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/24611184/2185089654685169536/comments/default/8869367566524633979'/><link rel='alternate' type='text/html' href='http://www.eishay.com/2009/07/microbenchmarking-scala-vs-java.html?showComment=1246643907623#c8869367566524633979' title=''/><author><name>Eishay Smith</name><uri>http://www.blogger.com/profile/09443096006184006852</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://2.bp.blogspot.com/_O9TJAb-LjDE/SdlzHG9KSlI/AAAAAAAAAYc/kCnqSgnk0es/S220/n646386018_2207361_5928583.jpg'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.eishay.com/2009/07/microbenchmarking-scala-vs-java.html' ref='tag:blogger.com,1999:blog-24611184.post-2185089654685169536' source='http://www.blogger.com/feeds/24611184/posts/default/2185089654685169536' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1856236024'/></entry><entry><id>tag:blogger.com,1999:blog-24611184.post-8637548731810573879</id><published>2009-07-03T10:25:34.973-07:00</published><updated>2009-07-03T10:25:34.973-07:00</updated><title type='text'>Of course not, Eishay. That would be ridiculous.

...</title><content type='html'>Of course not, Eishay. That would be ridiculous.&lt;br /&gt;&lt;br /&gt;I said that you have to use a while loop in Scala. A while loop (in Scala or Java) performs as well as a for loop in Java.&lt;br /&gt;&lt;br /&gt;Ismael</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/24611184/2185089654685169536/comments/default/8637548731810573879'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/24611184/2185089654685169536/comments/default/8637548731810573879'/><link rel='alternate' type='text/html' href='http://www.eishay.com/2009/07/microbenchmarking-scala-vs-java.html?showComment=1246641934973#c8637548731810573879' title=''/><author><name>Ismael Juma</name><uri>http://www.blogger.com/profile/17398483226873559286</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.eishay.com/2009/07/microbenchmarking-scala-vs-java.html' ref='tag:blogger.com,1999:blog-24611184.post-2185089654685169536' source='http://www.blogger.com/feeds/24611184/posts/default/2185089654685169536' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-2084065487'/></entry><entry><id>tag:blogger.com,1999:blog-24611184.post-3154094721537158866</id><published>2009-07-03T09:59:28.888-07:00</published><updated>2009-07-03T09:59:28.888-07:00</updated><title type='text'>@Nick I figured its a typo, just teasing ;-) 

@Is...</title><content type='html'>@Nick I figured its a typo, just teasing ;-) &lt;br /&gt;&lt;br /&gt;@Ismael did you mean you need to cripple Java so it won&amp;#39;t use for loops in order to make it as slow as Scala? Is there a way to make similar Scala code as fast as Java in spite of the lack of for loops?</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/24611184/2185089654685169536/comments/default/3154094721537158866'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/24611184/2185089654685169536/comments/default/3154094721537158866'/><link rel='alternate' type='text/html' href='http://www.eishay.com/2009/07/microbenchmarking-scala-vs-java.html?showComment=1246640368888#c3154094721537158866' title=''/><author><name>Eishay Smith</name><uri>http://www.blogger.com/profile/09443096006184006852</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://2.bp.blogspot.com/_O9TJAb-LjDE/SdlzHG9KSlI/AAAAAAAAAYc/kCnqSgnk0es/S220/n646386018_2207361_5928583.jpg'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.eishay.com/2009/07/microbenchmarking-scala-vs-java.html' ref='tag:blogger.com,1999:blog-24611184.post-2185089654685169536' source='http://www.blogger.com/feeds/24611184/posts/default/2185089654685169536' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1856236024'/></entry><entry><id>tag:blogger.com,1999:blog-24611184.post-1228108882302858561</id><published>2009-07-03T00:34:36.013-07:00</published><updated>2009-07-03T00:34:36.013-07:00</updated><title type='text'>Hi Eishay,

It&amp;#39;s not surprising that @speciali...</title><content type='html'>Hi Eishay,&lt;br /&gt;&lt;br /&gt;It&amp;#39;s not surprising that @specialized doesn&amp;#39;t help much here. As far as I can see, while loops and Array[Int] are used almost everywhere (I only found one exception).&lt;br /&gt;&lt;br /&gt;Scala is as fast as Java if you write it like Java (this means using while loops since Scala doesn&amp;#39;t have an equivalent of Java&amp;#39;s for loops).&lt;br /&gt;&lt;br /&gt;The point of @specialized is to help cases where the code is higher level and you use anonymous functions extensively as well as higher-level collections. In the latter case, @specialized has the potential to allow Scala to do better than Java when using collections (not arrays) from the standard library (due to boxing on the Java side). Note that I said _potential_. :)&lt;br /&gt;&lt;br /&gt;Best,&lt;br /&gt;Ismael</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/24611184/2185089654685169536/comments/default/1228108882302858561'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/24611184/2185089654685169536/comments/default/1228108882302858561'/><link rel='alternate' type='text/html' href='http://www.eishay.com/2009/07/microbenchmarking-scala-vs-java.html?showComment=1246606476013#c1228108882302858561' title=''/><author><name>Ismael Juma</name><uri>http://www.blogger.com/profile/17398483226873559286</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.eishay.com/2009/07/microbenchmarking-scala-vs-java.html' ref='tag:blogger.com,1999:blog-24611184.post-2185089654685169536' source='http://www.blogger.com/feeds/24611184/posts/default/2185089654685169536' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-2084065487'/></entry><entry><id>tag:blogger.com,1999:blog-24611184.post-5941940091026982687</id><published>2009-07-02T22:14:42.524-07:00</published><updated>2009-07-02T22:14:42.524-07:00</updated><title type='text'>Okay, that was just a typo in my published code se...</title><content type='html'>Okay, that was just a typo in my published code segment. I really compared 100.000.&lt;br /&gt;&lt;br /&gt;I also tried to figure out the influence of HotSpot, but I couldn&amp;#39;t see any remarkable improvements. And also, in my benchmark Java is 30% faster.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/24611184/2185089654685169536/comments/default/5941940091026982687'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/24611184/2185089654685169536/comments/default/5941940091026982687'/><link rel='alternate' type='text/html' href='http://www.eishay.com/2009/07/microbenchmarking-scala-vs-java.html?showComment=1246598082524#c5941940091026982687' title=''/><author><name>Nick Wiedenbrueck</name><uri>http://www.blogger.com/profile/08284848227891035967</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://lh3.ggpht.com/_xpFhbnJFlj4/SS8VqCZHtDI/AAAAAAAAAlU/Spj2qdkMeUc/s128/pic01sw.JPG'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.eishay.com/2009/07/microbenchmarking-scala-vs-java.html' ref='tag:blogger.com,1999:blog-24611184.post-2185089654685169536' source='http://www.blogger.com/feeds/24611184/posts/default/2185089654685169536' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1041436981'/></entry></feed>
