This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Groovy's performance....

 
Vimala Shirur
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is groovy slower compared to JAVA?

I like groovy and i have used it in a small in-house project where we retrieve data from the d/b and display it on the browser. This display seems slower as we are using the htmlbuiler provided by groovy. Because of this slowness, we are planning to choose JAVA instead of groovy for another project.

Can someone tell what makes groovy to be slow?

Thanks!
 
Raghavan Muthu
Ranch Hand
Posts: 3381
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is a little different aspect i guess. As they say Groovy is in place to ease up the tasks with more efficiency and betterment towards performance, hearing the slowness caused by Groovy is quite unbelievable! Isn't it?
 
Dierk K├Ânig
author
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Groovy is slower than Java (although we get closer with every release).

If for example you do "1+1" in Java, this will not take any time at all. The Java compiler optimizes it to "2".
In Groovy "1+1" is short for "new Integer(1).plus(new Integer(1))" which obviously takes some time. Furthermore, the ctor calls and the plus() method call will go through the Groovy method dispatch which takes additional time.

That said, it is very unlikely that users will recognize any difference in application performance between Groovy and Java apps if one of the following is involved: database, gui, networking, web services, file access, external processes. These operations take orders of magnitude longer than any in-memory calculation no matter if called from Java or Groovy.

If your DB/MarkupBuilder dependent app is slow, I advice running it through a profiler to find the real performance hog. Any standard Java profiler will do. In 9 of 10 cases it's the database (but not always!).

Cheers
Dierk
 
Pedro Fracarolli
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are some news about Groovy's future (and performance) at InfoQ

See ya.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic