Tuesday, July 10, 2012

Java vs Groovy2.0 vs Scala Simple Performance Test

Since Groovy2.0 is out, I want to re-test the performance difference between Java, Groovy2.0 and Scala. The previous tests: Part 1 and Part 2

The machine and the code are the same as the previous tests. The only thing change is that I am using groovy2.0. To make it the results more clear, I am only including the results for f(30) and f(50):

n implementation result Java Groovy2 Groovy2 @CompileStatic Scala
30 for-loop 832040 0 (ms) 0 (ms) 1 (ms) 0 (ms)
30 recursive 832040 19 (ms) 66 (ms) 20 (ms) 20 (ms)
50 for-loop 12586269025 0 (ms) 0 (ms) 0 (ms) 0 (ms)
50 recursive 12586269025 182462 (ms) 356920 (ms) 176468 (ms) 180898 (ms)


I split the Groovy test to two. One with the new annotation @CompileStatic (I put it in the class level) and one without. The one without is suppose to use the JDK7 new feature invokeDynamic which should give some performance gain but unfortunately JDK7 is not supported in Mac Snow Leopard. @CompileStatic is a new feature that give performance gain to groovy code with type safety check where dynamic features are not required. More information here.

The results show that the big performance gain by adding the @CompileStatic which is making Groovy up to par with Java and Scala. The common ways for Groovy developers to solve performance's problem is to write that piece of code in Java. Now with this new @CompileStatic, everything can be just in Groovy. And the ideal case is that if the JDK7 invokeDynamic gives Groovy2 the same performance as Java, then the @CompileStatic is not needed at all (if you want type safe, you can just use another new annotation @TypeChecked).

28 comments:

  1. I don't think Groovy, although using @CompileStatic, is faster than Java...

    ReplyDelete
  2. Thanks for sharing such informative article on Loadrunner Automation testing tool. This load testing tool will provide most precise information about the quality of software. Loadrunner training in Chennai

    ReplyDelete
  3. An obligation of appreciation is all Hadoop Training in Chennai together for sharing such instructive article on Loadrunner Automation testing instrument. Hadoop Training in Chennai This stack testing mechanical Oracle Training in Chennai assembly will give most correct information about the way of programming.

    ReplyDelete
  4. Cloud computing is storing and accessing the large data sets over the internet instead of your PC computer. So that you can manage the data and program anywhere through the internet.
    Regards..
    Cloud Computing Training Centers in Chennai

    ReplyDelete
  5. Your blog is really useful for me. Thanks for sharing this informative blog. If anyone wants to get real time Oracle Training Chennai reach FITA located at Chennai. They give professional and job oriented training for all students.

    ReplyDelete
  6. Thanks for sharing this information. Java is one of the popular object oriented programming language used for many of the multinational corporation. So learning Java Training in Chennai is really helpful to make a bright future.

    ReplyDelete
  7. Excellent post. Android is an open source operating system used for tablet computers and smartphones. If your are interested to develop creative mobile applications then you must learn about android OS. Its helpful for you.

    Regards..
    Android Training Institutes in Chennai

    ReplyDelete
  8. Nice information. Salesforce is a most powerful CRM tool used for manage all customers including potential customers. Salesforce Training in Chennai offering this course with experienced professionals.

    ReplyDelete
  9. Really nice post. Unix is a multiuser and multi tasking operating system at the same time. Unix Training in Chennai offering real time Unix course at reasonable cost.

    ReplyDelete
  10. Really awesome blog. Software testing is a method of executing the application or program with the intent of searching the software errors. Software Testing Training in Chennai offering this course at reasonable cost.


    ReplyDelete
  11. Nice for sharing this wonderfull article.......and such article have a more valuable information.....thanks for sharing this kind of article......... informatica training in chennai

    ReplyDelete
  12. Thanks for this information; I hope it will use much reader who looking you regularly likes me…
    Regards,
    Salesforce course in Chennai

    ReplyDelete
  13. Nice information...!
    Your useful article is appeared to gain my knowledge skills in a better way.Entire java will enable the basic concepts with the grooving technologies.JavaScript is a booming tech and also jquery is a tedious one to develop your career skills.Gain more knowledge in JavaScript and JQuery by visoting our link:

    http://www.thinkittraining.in/java-script-and--jquery

    ReplyDelete
  14. Hi, you have said the certain and most useful points regarding cloud computing technology. As the amount of data being used daily is increasing gradually, technology like this should be appreciated. Keep blogging.


    Cloud computing training

    ReplyDelete
  15. There are lots of information about latest technology, like Hadoop cluster is a special type of computational cluster designed specifically for storing and analyzing huge amounts of unstructured data in a distributed computing environment. This information seems to be more unique and interesting. Thanks for sharing.

    Big Data Training in Chennai | Big Data Training | Hadoop Course in Chennai

    ReplyDelete
  16. Thanks for sharing such a great information..Its really nice and informative.
    hadoop training in Chennai

    ReplyDelete
  17. Thank you for taking time to provide us the useful information with us. This is really useful. Keep on blogging.
    Loadrunner Training in Chennai

    ReplyDelete
  18. It is new to me and thanks for sharing a new information.
    dot-net-training in chennai

    ReplyDelete
  19. It is nice and informative blog.Thanks for this article.
    Java Training in Chennai

    ReplyDelete
  20. Great Share!!!Each and every concept was explained clearly.The people who are interested to learn salesforce,can join in our salesforce training institute.Here we offered world class training with placement support.By clicking Salesforce training in Chennai,you will get more information.

    ReplyDelete
  21. I got information about the java and it is really informative thanks for sharing this information.

    sharepoint-training-in-chennai

    ReplyDelete
  22. It is good and is very interesting to read this information.Thanks for your sharing.
    Sharepoint admin training in chennai

    ReplyDelete
  23. It looks like you spend a lot of effort and time on your blog. I have bookmarked it and I am looking forward to reading new articles. Keep up the good work..

    Hadoop Training in Chennai

    ReplyDelete
  24. thank for sharing..
    SEO training in hyderabad by experts in digital markeing And by prosessional experts in seo.All the training by placement and also guide by the professionals.SEO training in hyderabad

    ReplyDelete

  25. Thanks for sharing with us that awesome article you have amazing blog.....
    salesforce training in hyderabad

    ReplyDelete