File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Groovy and the fly likes Groovy's performance.... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Languages » Groovy
Bookmark "Groovy Watch "Groovy New topic

Groovy's performance....

Vimala Shirur

Joined: Jan 12, 2001
Posts: 12
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?

Raghavan Muthu
Ranch Hand

Joined: Apr 20, 2006
Posts: 3381

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?

Everything has got its own deadline including one's EGO!
[CodeBarn] [Java Concepts-easily] [Corey's articles] [SCJP-SUN] [Servlet Examples] [Java Beginners FAQ] [Sun-Java Tutorials] [Java Coding Guidelines]
Dierk König
Ranch Hand

Joined: Nov 01, 2006
Posts: 43
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!).

Pedro Fracarolli

Joined: Sep 03, 2008
Posts: 20
There are some news about Groovy's future (and performance) at InfoQ

See ya.
I agree. Here's the link:
subject: Groovy's performance....
It's not a secret anymore!