File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Languages » Groovy
Bookmark "Groovy Watch "Groovy New topic
Author

Groovy's performance....

Vimala Shirur
Greenhorn

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?

Thanks!
Raghavan Muthu
Ranch Hand

Joined: Apr 20, 2006
Posts: 3344

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
author
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!).

Cheers
Dierk
Pedro Fracarolli
Greenhorn

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

See ya.
 
jQuery in Action, 2nd edition
 
subject: Groovy's performance....
 
Similar Threads
Packaging and Documentation
Groovy newbie questions
why should one count on groovy and grails rather than java
Groovy won't replace Java - Why not?
Learning two languages this year