• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

Groovy's performance....

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Ranch Hand
Posts: 3389
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
author
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are some news about Groovy's future (and performance) at InfoQ

See ya.
 
reply
    Bookmark Topic Watch Topic
  • New Topic