The moose likes Groovy and the fly likes Groovy's performance vs. Java Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Other Languages » Groovy
Reply Bookmark "Groovy Watch "Groovy New topic
Author

Groovy's performance vs. Java

Josh Brown
Ranch Hand

Joined: Oct 09, 2007
Posts: 35
You knew the performance question was coming, right? How does Groovy's performance measure against Java's? I've read and heard several times that Groovy is nowhere near Java as far as performance. Is Groovy's performance improving with age?

On a related note, I've heard that "you can always write Java if Groovy doesn't perform well enough for you." While this is true, I don't like it. If Groovy doesn't perform well, its performance should be improved. I don't think the solution should be for me to go write Java. There's a reason I chose Groovy to solve the problem, so why should I have to switch to Java (even if only for a few lines of code)?

Are there people working to improve Groovy's performance?


Josh
Inside the Machine
Venkat Subramaniam
Author
Ranch Hand

Joined: Jan 28, 2008
Posts: 79
Performance is one of the major issues that is in the minds of Groovy committers. I have spoken to them and they are very well aware of it and certainly it is not something being ignored. Groovy 1.6 is expected to have some improvements. I am sure as Groovy matures, performance will be addressed further as well.

Having said that there is nothing wrong with using Java where is is better and using Groovy where it shines. You have that choice and there is no reason not to take advantage. I have never seen a solution that solves all my problems all the time.
Josh Brown
Ranch Hand

Joined: Oct 09, 2007
Posts: 35
Thanks for the quick response.

I have never seen a solution that solves all my problems all the time.


I haven't either, and I don't suppose that'll ever happen.
Mark Herschberg
Sheriff

Joined: Dec 04, 2000
Posts: 6035
It should be noted that while groovy is generally slower because it's interpreted, some things in groovy are faster, for example there's no type checking so that saves some overhead.

--Mark
Venkat Subramaniam
Author
Ranch Hand

Joined: Jan 28, 2008
Posts: 79
My first impression was that Groovy interpreted code as well. That is not true. Groovy code is not interpreted. Groovy code is always compiled into bytecode before execution. Even if you don't use groovyc explicitly, when you run groovy command, it first compiles your code in memory and then runs that code.
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Originally posted by Mark Herschberg:
for example there's no type checking so that saves some overhead.


That is, in fact, not true, as far as I know. (It might be that we are defining "type" differently, though.)


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18641
Types are generally checked at runtime rather than compile time, but they're still checked.


"I'm not back." - Bill Harding, Twister
 
 
subject: Groovy's performance vs. Java
 
WebSphere development made easy
without the weight of IBM tools
http://www.myeclipseide.com