<?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-24248206.post1906917844933476002..comments</id><updated>2011-12-24T17:34:29.650+01:00</updated><category term='parser generator'/><category term='case study'/><category term='DSLs'/><category term='helios'/><category term='slides'/><category term='left factoring'/><category term='javascript'/><category term='nordic coding'/><category term='domain-specific languages'/><category term='kotlin'/><category term='jdt'/><category term='autosar'/><category term='conference'/><category term='Java multi-line strings'/><category term='xpand'/><category term='scoping'/><category term='extension methods'/><category term='CG2011'/><category term='Galileo'/><category term='itemis'/><category term='UML modeling brumm brumm'/><category term='GSoC'/><category term='Languages'/><category term='git'/><category term='eclipse modeling itemis'/><category term='DSL'/><category term='DSL code generation eclipse xtext slides'/><category term='xtext'/><category term='eclipse'/><category term='Eclipse EclipseCon Modeling Xtext'/><category term='Guice'/><category term='code generation'/><category term='presentations'/><category term='language design'/><category term='builder API'/><category term='guicecon'/><category term='emf index'/><category term='JVM'/><category term='scala'/><category term='OSGi'/><category term='eclipsecon'/><category term='java'/><category term='democamps'/><category term='refactoring'/><category term='english'/><category term='webinar'/><category term='Java testing performance'/><category term='example'/><category term='protocol buffers'/><category term='left recursion'/><category term='jax 2010'/><category term='website'/><category term='lambda'/><category term='fowler'/><category term='api design'/><category term='packrat'/><category term='java.scala'/><category term='oaw eclipse xtext'/><category term='android'/><category term='expressions'/><category term='MDSD'/><category term='xtend'/><category term='groovy'/><category term='eclipse summit'/><category term='index'/><category term='xbase'/><category term='modeling'/><category term='kiel'/><category term='release'/><category term='automotive'/><category term='http://www.blogger.com/img/gl.link.gif'/><category term='xtend 2'/><category term='internal DSLs'/><category term='oAW'/><category term='codegeneration'/><category term='OpenJDK'/><title type='text'>Comments on Sven Efftinge's Blog: Groovy, Scala, Java, Xtend - an UPDATED stupid com...</title><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://blog.efftinge.de/feeds/1906917844933476002/comments/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/24248206/1906917844933476002/comments/default'/><link rel='alternate' type='text/html' href='http://blog.efftinge.de/2011/12/groovy-scala-java-xtend-updated-stupid.html'/><author><name>Sven Efftinge</name><uri>http://www.blogger.com/profile/11751196715155150517</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://3.bp.blogspot.com/_Ii_da0jTxAY/SNxsRY6r26I/AAAAAAAAABk/WzYcCAnzC9Q/S220/foto-openbc.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>19</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-24248206.post-6796034023067186049</id><published>2011-12-24T17:34:29.650+01:00</published><updated>2011-12-24T17:34:29.650+01:00</updated><title type='text'>This is a bit off topic, but are there any major E...</title><content type='html'>This is a bit off topic, but are there any major Eclipse projects, not from those of you who brought us XText/XTend, that are coded in, or anticipating migrating to, XTend? XTend compiles to Java source code, so it can&amp;#39;t be too great of a risk to migrate.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/24248206/1906917844933476002/comments/default/6796034023067186049'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/24248206/1906917844933476002/comments/default/6796034023067186049'/><link rel='alternate' type='text/html' href='http://blog.efftinge.de/2011/12/groovy-scala-java-xtend-updated-stupid.html?showComment=1324744469650#c6796034023067186049' title=''/><author><name>Michel Parisien</name><uri>http://www.blogger.com/profile/16363456979757632132</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://blog.efftinge.de/2011/12/groovy-scala-java-xtend-updated-stupid.html' ref='tag:blogger.com,1999:blog-24248206.post-1906917844933476002' source='http://www.blogger.com/feeds/24248206/posts/default/1906917844933476002' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1554691751'/></entry><entry><id>tag:blogger.com,1999:blog-24248206.post-2811213857061839860</id><published>2011-12-23T16:49:06.318+01:00</published><updated>2011-12-23T16:49:06.318+01:00</updated><title type='text'>And by the way: the main reason why your Scala exa...</title><content type='html'>And by the way: the main reason why your Scala example is really slow is because you used the deprecated Application trait. The more recent App trait fixes the issues with Application.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/24248206/1906917844933476002/comments/default/2811213857061839860'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/24248206/1906917844933476002/comments/default/2811213857061839860'/><link rel='alternate' type='text/html' href='http://blog.efftinge.de/2011/12/groovy-scala-java-xtend-updated-stupid.html?showComment=1324655346318#c2811213857061839860' title=''/><author><name>Moritz</name><uri>http://www.blogger.com/profile/12931735784670170083</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://blog.efftinge.de/2011/12/groovy-scala-java-xtend-updated-stupid.html' ref='tag:blogger.com,1999:blog-24248206.post-1906917844933476002' source='http://www.blogger.com/feeds/24248206/posts/default/1906917844933476002' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-317921094'/></entry><entry><id>tag:blogger.com,1999:blog-24248206.post-8819318019817998111</id><published>2011-12-23T16:46:12.382+01:00</published><updated>2011-12-23T16:46:12.382+01:00</updated><title type='text'>If you change the &lt;a href="https://gist.github.com...</title><content type='html'>If you change the &lt;a href="https://gist.github.com/1514485" rel="nofollow"&gt;code to use an ArrayBuffer (which is the equivalent to ArrayList) and use tail recursion&lt;/a&gt; the Scala version actually runs faster than the Java one. &lt;br /&gt;&lt;br /&gt;I cheated a little by adding the Scala Library to the bootclasspath - if you invoke it using the scala shell script the execution time is the same as for the Java version.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/24248206/1906917844933476002/comments/default/8819318019817998111'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/24248206/1906917844933476002/comments/default/8819318019817998111'/><link rel='alternate' type='text/html' href='http://blog.efftinge.de/2011/12/groovy-scala-java-xtend-updated-stupid.html?showComment=1324655172382#c8819318019817998111' title=''/><author><name>Moritz</name><uri>http://www.blogger.com/profile/12931735784670170083</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://blog.efftinge.de/2011/12/groovy-scala-java-xtend-updated-stupid.html' ref='tag:blogger.com,1999:blog-24248206.post-1906917844933476002' source='http://www.blogger.com/feeds/24248206/posts/default/1906917844933476002' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-317921094'/></entry><entry><id>tag:blogger.com,1999:blog-24248206.post-6517380518318793865</id><published>2011-12-22T18:41:12.801+01:00</published><updated>2011-12-22T18:41:12.801+01:00</updated><title type='text'>I update both the &lt;a href="https://gist.github.com...</title><content type='html'>I update both the &lt;a href="https://gist.github.com/1511016" rel="nofollow"&gt;java&lt;/a&gt; and &lt;a href="https://gist.github.com/1506019" rel="nofollow"&gt;scala&lt;/a&gt;  versions of the code and got the fastest performance using pure arrays instead of lists.&lt;br /&gt;&lt;br /&gt;Both run in exactly the same time.&lt;br /&gt;&lt;br /&gt;Java ArrayList performance is similar to Scala ListBuffer.&lt;br /&gt;&lt;br /&gt;If you really want performance in scala, use arrays and while loops (there is an otherhead to use &lt;i&gt;1 to n&lt;/i&gt; construct since it generates a list).</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/24248206/1906917844933476002/comments/default/6517380518318793865'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/24248206/1906917844933476002/comments/default/6517380518318793865'/><link rel='alternate' type='text/html' href='http://blog.efftinge.de/2011/12/groovy-scala-java-xtend-updated-stupid.html?showComment=1324575672801#c6517380518318793865' title=''/><author><name>Michel</name><uri>http://www.blogger.com/profile/02605154874375515980</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://blog.efftinge.de/2011/12/groovy-scala-java-xtend-updated-stupid.html' ref='tag:blogger.com,1999:blog-24248206.post-1906917844933476002' source='http://www.blogger.com/feeds/24248206/posts/default/1906917844933476002' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-931484490'/></entry><entry><id>tag:blogger.com,1999:blog-24248206.post-8167493728652177968</id><published>2011-12-22T16:16:34.746+01:00</published><updated>2011-12-22T16:16:34.746+01:00</updated><title type='text'>@Sven Sorry I did a small mistake which lead to wr...</title><content type='html'>@Sven Sorry I did a small mistake which lead to wrong figures. It is actually exactly as fast as your optimized snippet.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/24248206/1906917844933476002/comments/default/8167493728652177968'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/24248206/1906917844933476002/comments/default/8167493728652177968'/><link rel='alternate' type='text/html' href='http://blog.efftinge.de/2011/12/groovy-scala-java-xtend-updated-stupid.html?showComment=1324566994746#c8167493728652177968' title=''/><author><name>Stefan Oehme</name><uri>http://www.blogger.com/profile/17311392191635575113</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='32' height='32' src='//lh6.googleusercontent.com/-68H371rqXJk/AAAAAAAAAAI/AAAAAAAAGfo/CpAkuyqYxQM/s512-c/photo.jpg'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.efftinge.de/2011/12/groovy-scala-java-xtend-updated-stupid.html' ref='tag:blogger.com,1999:blog-24248206.post-1906917844933476002' source='http://www.blogger.com/feeds/24248206/posts/default/1906917844933476002' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-221834357'/></entry><entry><id>tag:blogger.com,1999:blog-24248206.post-341391076901223331</id><published>2011-12-22T00:09:10.628+01:00</published><updated>2011-12-22T00:09:10.628+01:00</updated><title type='text'>@Sven: your java snippet is unbeatable for me (so ...</title><content type='html'>@Sven: your java snippet is unbeatable for me (so far). can we add additional languages - e.g. assembler ;-)</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/24248206/1906917844933476002/comments/default/341391076901223331'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/24248206/1906917844933476002/comments/default/341391076901223331'/><link rel='alternate' type='text/html' href='http://blog.efftinge.de/2011/12/groovy-scala-java-xtend-updated-stupid.html?showComment=1324508950628#c341391076901223331' title=''/><author><name>Daniel Dietrich's Blog</name><uri>http://www.blogger.com/profile/02492628698632995681</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='32' height='22' src='http://1.bp.blogspot.com/_ZDt4Zlg8qZI/Sqbnmk-29qI/AAAAAAAAAAM/kgq72NuU_GI/S220/dd.png'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.efftinge.de/2011/12/groovy-scala-java-xtend-updated-stupid.html' ref='tag:blogger.com,1999:blog-24248206.post-1906917844933476002' source='http://www.blogger.com/feeds/24248206/posts/default/1906917844933476002' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1906636037'/></entry><entry><id>tag:blogger.com,1999:blog-24248206.post-2643422269844877842</id><published>2011-12-22T00:00:36.063+01:00</published><updated>2011-12-22T00:00:36.063+01:00</updated><title type='text'>@Stefan: Did you mean 5 times faster than &lt;a href=...</title><content type='html'>@Stefan: Did you mean 5 times faster than &lt;a href="https://gist.github.com/1506285" rel="nofollow"&gt;this Java snippet&lt;/a&gt;?</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/24248206/1906917844933476002/comments/default/2643422269844877842'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/24248206/1906917844933476002/comments/default/2643422269844877842'/><link rel='alternate' type='text/html' href='http://blog.efftinge.de/2011/12/groovy-scala-java-xtend-updated-stupid.html?showComment=1324508436063#c2643422269844877842' title=''/><author><name>Sven Efftinge</name><uri>http://www.blogger.com/profile/11751196715155150517</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://3.bp.blogspot.com/_Ii_da0jTxAY/SNxsRY6r26I/AAAAAAAAABk/WzYcCAnzC9Q/S220/foto-openbc.jpg'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.efftinge.de/2011/12/groovy-scala-java-xtend-updated-stupid.html' ref='tag:blogger.com,1999:blog-24248206.post-1906917844933476002' source='http://www.blogger.com/feeds/24248206/posts/default/1906917844933476002' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1100628811'/></entry><entry><id>tag:blogger.com,1999:blog-24248206.post-4376005286010589557</id><published>2011-12-21T23:57:58.678+01:00</published><updated>2011-12-21T23:57:58.678+01:00</updated><title type='text'>@Jochen: 
I understood that you think the other sa...</title><content type='html'>@Jochen: &lt;br /&gt;I understood that you think the other samples don&amp;#39;t have to do dynamic dispatch. If that is really the case the comparison is unfair (despite from that it&amp;#39;s actually really unfair since I just hacked away some code without specifying any kind of requirements or even have deeper knowledge of Groovy. And also my measurement technique was bogus...).&lt;br /&gt;&lt;br /&gt;But I still think all the examples do dynamic dispatch. Yes, only Groovy and Xtend have to call a different methods for each case, but that doesn&amp;#39;t really make a big difference. Calling a method in Java is fast!. If I delegate each case to a method on it&amp;#39;s own in the Java example and disable JIT it&amp;#39;s only marginally slower (~60ms difference on my machine).&lt;br /&gt;&lt;br /&gt;Xtend binds statically just like Java. For a set of visible overloaded dispatch methods (i.e. a multi method) a synthetic dispatch method is inferred using the common super types of the arguments. So it is declaration site dispatching unlike in Groovy where dispatching is done on the call site. &lt;br /&gt;&lt;br /&gt;If I subclass such a class I can add new cases (within the bounds of the argument types) and the synthetic dispatch method will be overridden. &lt;a href="http://www.eclipse.org/Xtext/xtend/documentation/index.html#polymorphicDispatch" rel="nofollow"&gt;More details&lt;/a&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/24248206/1906917844933476002/comments/default/4376005286010589557'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/24248206/1906917844933476002/comments/default/4376005286010589557'/><link rel='alternate' type='text/html' href='http://blog.efftinge.de/2011/12/groovy-scala-java-xtend-updated-stupid.html?showComment=1324508278678#c4376005286010589557' title=''/><author><name>Sven Efftinge</name><uri>http://www.blogger.com/profile/11751196715155150517</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://3.bp.blogspot.com/_Ii_da0jTxAY/SNxsRY6r26I/AAAAAAAAABk/WzYcCAnzC9Q/S220/foto-openbc.jpg'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.efftinge.de/2011/12/groovy-scala-java-xtend-updated-stupid.html' ref='tag:blogger.com,1999:blog-24248206.post-1906917844933476002' source='http://www.blogger.com/feeds/24248206/posts/default/1906917844933476002' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1100628811'/></entry><entry><id>tag:blogger.com,1999:blog-24248206.post-4726458691611383765</id><published>2011-12-21T22:57:50.786+01:00</published><updated>2011-12-21T22:57:50.786+01:00</updated><title type='text'>Sven I think you did understand me a bit wrong. I ...</title><content type='html'>Sven I think you did understand me a bit wrong. I wasn&amp;#39;t about unfair, I tried to explain why Groovy does it that way and how the result from that then is.&lt;br /&gt;&lt;br /&gt;But I wonder what made you think that, performance wise, dynamic dispatch (or I should say multi method dispatch) is a strength?&lt;br /&gt;&lt;br /&gt;Anyway... I don&amp;#39;t agree that the other examples do dispatch at runtime. For that there should be at least one more method call from your dispatcher method. When I say dispatcher method, then I mean a method, that does some kind of method invocation by calling another method. In your case that would be what follows the instanceof checks. Since you there simply return the value, you do what JIT would have done otherwise. But only if JIT can do that. And that is actually a critical point. If you call bigger methods, then the JIT won&amp;#39;t inline the dispatcher anymore very fast. As result you loose inlining of the method you want to dispatch to for everything that calls the dispatcher method. And this then can have severe consequences. The only way around that would be to have the checks at the call sites - with other problems. &lt;br /&gt;&lt;br /&gt;I won&amp;#39;t now conclude the Groovy version is better in that, I just try to point out a general problem of such dispatcher methods. And I don&amp;#39;t know how Xtend does these things, but assuming that it will be only a little bit less fast than a direct method call in Java might in real life not be the real case. For your test here it is still true what Micheal said in the comments, you test mostly ArrayList performance. So at least for Scala, Java and Xtend, you don&amp;#39;t test method call performance with this one at all. &lt;br /&gt;&lt;br /&gt;I also don&amp;#39;t understand how you can claim Xtends doing multi method dispatch while at the same time claiming it will behave like Java in its calling logic... Java does no multi method dispatch. I don&amp;#39;t think that Xtend can have per default multi method dispatch and Java dispatch at the same time.&lt;br /&gt;&lt;br /&gt;You should also note that Groovy has this multi method logic per default, while in your case, you have to use your keyword to enable it. But assuming I want to enable it... can I subclass that class in Java and add another foo method, that then will be part of the dynamic dispatch, without having to rewrite the dispatcher method? Your text seems to say, that this is possible. If that is possible, then I would be very interested in knowing how. I am always eager to learn how to make something work, that I thought is impossible to do efficient.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/24248206/1906917844933476002/comments/default/4726458691611383765'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/24248206/1906917844933476002/comments/default/4726458691611383765'/><link rel='alternate' type='text/html' href='http://blog.efftinge.de/2011/12/groovy-scala-java-xtend-updated-stupid.html?showComment=1324504670786#c4726458691611383765' title=''/><author><name>Jochen "blackdrag" Theodorou</name><uri>http://www.blogger.com/profile/15853173707470873265</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://blog.efftinge.de/2011/12/groovy-scala-java-xtend-updated-stupid.html' ref='tag:blogger.com,1999:blog-24248206.post-1906917844933476002' source='http://www.blogger.com/feeds/24248206/posts/default/1906917844933476002' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1359481583'/></entry><entry><id>tag:blogger.com,1999:blog-24248206.post-923924876158914707</id><published>2011-12-21T20:01:33.005+01:00</published><updated>2011-12-21T20:01:33.005+01:00</updated><title type='text'>Here is a slightly more concise version.

// Scala...</title><content type='html'>Here is a slightly more concise version.&lt;br /&gt;&lt;br /&gt;// Scala needs Java 7 to make use of new fork/join framework (JSR-166)&lt;br /&gt;object Scala extends Application {&lt;br /&gt;  //  collection.parallel.ForkJoinTasks.defaultForkJoinPool.setParallelism(4)&lt;br /&gt;  val before = System.currentTimeMillis()&lt;br /&gt;  val absoluteResult = for (&lt;br /&gt;    _ &amp;lt;- (1 to 100000)/*.par*/; y &amp;lt;- List(&amp;quot;foo&amp;quot;, 23, true).map(foo)&lt;br /&gt;  ) yield y&lt;br /&gt;  println(&amp;quot;Took : &amp;quot; + (System.currentTimeMillis() - before)&lt;br /&gt;    + &amp;quot; ms, number of elements : &amp;quot; + absoluteResult.size)&lt;br /&gt;&lt;br /&gt;  def foo(obj: Any) =&lt;br /&gt;    obj match {&lt;br /&gt;      case _: String =&amp;gt; &amp;quot;String&amp;quot;&lt;br /&gt;      case _: Boolean =&amp;gt; &amp;quot;Boolean&amp;quot;&lt;br /&gt;      case _: Integer =&amp;gt; &amp;quot;Integer&amp;quot;&lt;br /&gt;      case _ =&amp;gt; throw new IllegalArgumentException()&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Wondering, if parallelism would make a difference (if using Java 7). But uncommenting the above code seems to result in a dead lock. (I&amp;#39;m no Scala expert...)&lt;br /&gt;&lt;br /&gt;- Daniel</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/24248206/1906917844933476002/comments/default/923924876158914707'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/24248206/1906917844933476002/comments/default/923924876158914707'/><link rel='alternate' type='text/html' href='http://blog.efftinge.de/2011/12/groovy-scala-java-xtend-updated-stupid.html?showComment=1324494093005#c923924876158914707' title=''/><author><name>Daniel Dietrich's Blog</name><uri>http://www.blogger.com/profile/02492628698632995681</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='32' height='22' src='http://1.bp.blogspot.com/_ZDt4Zlg8qZI/Sqbnmk-29qI/AAAAAAAAAAM/kgq72NuU_GI/S220/dd.png'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.efftinge.de/2011/12/groovy-scala-java-xtend-updated-stupid.html' ref='tag:blogger.com,1999:blog-24248206.post-1906917844933476002' source='http://www.blogger.com/feeds/24248206/posts/default/1906917844933476002' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1906636037'/></entry><entry><id>tag:blogger.com,1999:blog-24248206.post-1237120711107554207</id><published>2011-12-21T19:48:46.848+01:00</published><updated>2011-12-21T19:48:46.848+01:00</updated><title type='text'>Just for fun: A Clojure version using Arrays. Abou...</title><content type='html'>Just for fun: A Clojure version using Arrays. About 5 times faster than the optimized Java version. Of course this is far away from functional style ;)&lt;br /&gt;&lt;br /&gt;https://gist.github.com/1507155</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/24248206/1906917844933476002/comments/default/1237120711107554207'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/24248206/1906917844933476002/comments/default/1237120711107554207'/><link rel='alternate' type='text/html' href='http://blog.efftinge.de/2011/12/groovy-scala-java-xtend-updated-stupid.html?showComment=1324493326848#c1237120711107554207' title=''/><author><name>Stefan Oehme</name><uri>http://www.blogger.com/profile/17311392191635575113</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='32' height='32' src='//lh6.googleusercontent.com/-68H371rqXJk/AAAAAAAAAAI/AAAAAAAAGfo/CpAkuyqYxQM/s512-c/photo.jpg'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.efftinge.de/2011/12/groovy-scala-java-xtend-updated-stupid.html' ref='tag:blogger.com,1999:blog-24248206.post-1906917844933476002' source='http://www.blogger.com/feeds/24248206/posts/default/1906917844933476002' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-221834357'/></entry><entry><id>tag:blogger.com,1999:blog-24248206.post-9161881126227420355</id><published>2011-12-21T19:21:36.011+01:00</published><updated>2011-12-21T19:21:36.011+01:00</updated><title type='text'>Finally, here is a Clojure version using mutable d...</title><content type='html'>Finally, here is a Clojure version using mutable data:&lt;br /&gt;&lt;br /&gt;https://gist.github.com/1506973&lt;br /&gt;&lt;br /&gt;For large numbers it&amp;#39;s runtime converges on that of the Java implementation. Not bad for a dynamically typed language.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/24248206/1906917844933476002/comments/default/9161881126227420355'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/24248206/1906917844933476002/comments/default/9161881126227420355'/><link rel='alternate' type='text/html' href='http://blog.efftinge.de/2011/12/groovy-scala-java-xtend-updated-stupid.html?showComment=1324491696011#c9161881126227420355' title=''/><author><name>Stefan Oehme</name><uri>http://www.blogger.com/profile/17311392191635575113</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='32' height='32' src='//lh6.googleusercontent.com/-68H371rqXJk/AAAAAAAAAAI/AAAAAAAAGfo/CpAkuyqYxQM/s512-c/photo.jpg'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.efftinge.de/2011/12/groovy-scala-java-xtend-updated-stupid.html' ref='tag:blogger.com,1999:blog-24248206.post-1906917844933476002' source='http://www.blogger.com/feeds/24248206/posts/default/1906917844933476002' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-221834357'/></entry><entry><id>tag:blogger.com,1999:blog-24248206.post-8900383105547408533</id><published>2011-12-21T15:51:56.651+01:00</published><updated>2011-12-21T15:51:56.651+01:00</updated><title type='text'>Of course, I didn&amp;#39;t try to write efficient but...</title><content type='html'>Of course, I didn&amp;#39;t try to write efficient but idiomatic code. Since my Scala knowledge is a bit old and mostly forgotten, I&amp;#39;m glad others helped out a bit.&lt;br /&gt;&lt;br /&gt;If you&amp;#39;re looking for a challenge try to beat &lt;a href="https://gist.github.com/1506285" rel="nofollow"&gt;this Java version&lt;/a&gt;. It&amp;#39;s approx. three times faster than Viktor&amp;#39;s Scala version.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/24248206/1906917844933476002/comments/default/8900383105547408533'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/24248206/1906917844933476002/comments/default/8900383105547408533'/><link rel='alternate' type='text/html' href='http://blog.efftinge.de/2011/12/groovy-scala-java-xtend-updated-stupid.html?showComment=1324479116651#c8900383105547408533' title=''/><author><name>Sven Efftinge</name><uri>http://www.blogger.com/profile/11751196715155150517</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://3.bp.blogspot.com/_Ii_da0jTxAY/SNxsRY6r26I/AAAAAAAAABk/WzYcCAnzC9Q/S220/foto-openbc.jpg'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.efftinge.de/2011/12/groovy-scala-java-xtend-updated-stupid.html' ref='tag:blogger.com,1999:blog-24248206.post-1906917844933476002' source='http://www.blogger.com/feeds/24248206/posts/default/1906917844933476002' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1100628811'/></entry><entry><id>tag:blogger.com,1999:blog-24248206.post-9100946803241763132</id><published>2011-12-21T15:36:48.597+01:00</published><updated>2011-12-21T15:36:48.597+01:00</updated><title type='text'>And that&amp;#39;s the infamous Klang effect. Was just...</title><content type='html'>And that&amp;#39;s the infamous Klang effect. Was just about to post something about using a List.newBuilder within an @tailrec function. Pretty much would cover the same. Besides, you don&amp;#39;t append an item to the end of a list. That takes O(N) time for each list (O(N^2) total runtime.) Instead, you prepend a list of results and then reverse them. Takes O(N) in total.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/24248206/1906917844933476002/comments/default/9100946803241763132'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/24248206/1906917844933476002/comments/default/9100946803241763132'/><link rel='alternate' type='text/html' href='http://blog.efftinge.de/2011/12/groovy-scala-java-xtend-updated-stupid.html?showComment=1324478208597#c9100946803241763132' title=''/><author><name>Wheaties</name><uri>http://www.blogger.com/profile/04967183284484047446</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://blog.efftinge.de/2011/12/groovy-scala-java-xtend-updated-stupid.html' ref='tag:blogger.com,1999:blog-24248206.post-1906917844933476002' source='http://www.blogger.com/feeds/24248206/posts/default/1906917844933476002' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-947293902'/></entry><entry><id>tag:blogger.com,1999:blog-24248206.post-3477384454402099777</id><published>2011-12-21T14:33:59.435+01:00</published><updated>2011-12-21T14:33:59.435+01:00</updated><title type='text'>Michel,

on my machine Viktor&amp;#39;s version is alm...</title><content type='html'>Michel,&lt;br /&gt;&lt;br /&gt;on my machine Viktor&amp;#39;s version is almost twice as fast as yours. But your&amp;#39;s is twice as comprehensive and even a bit faster than the Java version. &lt;br /&gt;Very cool! :-)</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/24248206/1906917844933476002/comments/default/3477384454402099777'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/24248206/1906917844933476002/comments/default/3477384454402099777'/><link rel='alternate' type='text/html' href='http://blog.efftinge.de/2011/12/groovy-scala-java-xtend-updated-stupid.html?showComment=1324474439435#c3477384454402099777' title=''/><author><name>Sven Efftinge</name><uri>http://www.blogger.com/profile/11751196715155150517</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://3.bp.blogspot.com/_Ii_da0jTxAY/SNxsRY6r26I/AAAAAAAAABk/WzYcCAnzC9Q/S220/foto-openbc.jpg'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.efftinge.de/2011/12/groovy-scala-java-xtend-updated-stupid.html' ref='tag:blogger.com,1999:blog-24248206.post-1906917844933476002' source='http://www.blogger.com/feeds/24248206/posts/default/1906917844933476002' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1100628811'/></entry><entry><id>tag:blogger.com,1999:blog-24248206.post-846577170340068396</id><published>2011-12-21T14:30:43.640+01:00</published><updated>2011-12-21T14:30:43.640+01:00</updated><title type='text'>I punted and missed the call to foo in the loop.

...</title><content type='html'>I punted and missed the call to foo in the loop.&lt;br /&gt;&lt;br /&gt;And interestingly it does not change the time at all !&lt;br /&gt;&lt;br /&gt;So what are we comparing here ... only the time to process a collection based on the collection implementation. The time to call the method is so small we don&amp;#39;t see it ! Probably a JVM optimization (I&amp;#39;m on Java 6)</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/24248206/1906917844933476002/comments/default/846577170340068396'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/24248206/1906917844933476002/comments/default/846577170340068396'/><link rel='alternate' type='text/html' href='http://blog.efftinge.de/2011/12/groovy-scala-java-xtend-updated-stupid.html?showComment=1324474243640#c846577170340068396' title=''/><author><name>Michel</name><uri>http://www.blogger.com/profile/02605154874375515980</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://blog.efftinge.de/2011/12/groovy-scala-java-xtend-updated-stupid.html' ref='tag:blogger.com,1999:blog-24248206.post-1906917844933476002' source='http://www.blogger.com/feeds/24248206/posts/default/1906917844933476002' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-931484490'/></entry><entry><id>tag:blogger.com,1999:blog-24248206.post-2193092112557127001</id><published>2011-12-21T14:22:07.966+01:00</published><updated>2011-12-21T14:22:07.966+01:00</updated><title type='text'>Viktor,

I get similar performance with &lt;a href="h...</title><content type='html'>Viktor,&lt;br /&gt;&lt;br /&gt;I get similar performance with &lt;a href="https://gist.github.com/1506019" rel="nofollow"&gt;this code&lt;/a&gt; which is much easier to read (no explicit use of recursion).&lt;br /&gt;&lt;br /&gt;Michel : Took : 452 ms, number of elements : 3000000&lt;br /&gt;&lt;br /&gt;Viktor : Took : 421 ms, number of elements : 3000000&lt;br /&gt;&lt;br /&gt;Java collections : Took : 748 ms, number of elements : 3000000</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/24248206/1906917844933476002/comments/default/2193092112557127001'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/24248206/1906917844933476002/comments/default/2193092112557127001'/><link rel='alternate' type='text/html' href='http://blog.efftinge.de/2011/12/groovy-scala-java-xtend-updated-stupid.html?showComment=1324473727966#c2193092112557127001' title=''/><author><name>Michel</name><uri>http://www.blogger.com/profile/02605154874375515980</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://blog.efftinge.de/2011/12/groovy-scala-java-xtend-updated-stupid.html' ref='tag:blogger.com,1999:blog-24248206.post-1906917844933476002' source='http://www.blogger.com/feeds/24248206/posts/default/1906917844933476002' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-931484490'/></entry><entry><id>tag:blogger.com,1999:blog-24248206.post-8159023239905291840</id><published>2011-12-21T14:15:18.625+01:00</published><updated>2011-12-21T14:15:18.625+01:00</updated><title type='text'></title><content type='html'>This comment has been removed by the author.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/24248206/1906917844933476002/comments/default/8159023239905291840'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/24248206/1906917844933476002/comments/default/8159023239905291840'/><author><name>Michel</name><uri>http://www.blogger.com/profile/02605154874375515980</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://blog.efftinge.de/2011/12/groovy-scala-java-xtend-updated-stupid.html' ref='tag:blogger.com,1999:blog-24248206.post-1906917844933476002' source='http://www.blogger.com/feeds/24248206/posts/default/1906917844933476002' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.contentRemoved' value='true'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-931484490'/></entry><entry><id>tag:blogger.com,1999:blog-24248206.post-1180320835754381932</id><published>2011-12-21T14:13:37.527+01:00</published><updated>2011-12-21T14:13:37.527+01:00</updated><title type='text'>Fast, faster, Scala:

https://gist.github.com/1505...</title><content type='html'>Fast, faster, Scala:&lt;br /&gt;&lt;br /&gt;https://gist.github.com/1505997</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/24248206/1906917844933476002/comments/default/1180320835754381932'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/24248206/1906917844933476002/comments/default/1180320835754381932'/><link rel='alternate' type='text/html' href='http://blog.efftinge.de/2011/12/groovy-scala-java-xtend-updated-stupid.html?showComment=1324473217527#c1180320835754381932' title=''/><author><name>Viktor Klang</name><uri>http://www.blogger.com/profile/03102746463606533061</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='29' height='32' src='http://2.bp.blogspot.com/__QFDw0KfXRM/SnCTOfmas4I/AAAAAAAAAAM/ADBVzxJvGYY/S220/n599387799_8894.jpg'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.efftinge.de/2011/12/groovy-scala-java-xtend-updated-stupid.html' ref='tag:blogger.com,1999:blog-24248206.post-1906917844933476002' source='http://www.blogger.com/feeds/24248206/posts/default/1906917844933476002' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-203624587'/></entry></feed>
