Howdy,
> I planed to use Groovy in my new project based on JBoss Seam, but now I must
> wait.
> Can anyone give me some advice?
Groovy is also atrocious for doing the Naive recursive Fibonacci series,
but any computer science graduate or self taught programmer would
rewrite it into the faster, iterative form.
An advantage that Groovy has is that it is able to communicate directly
with a class or classes coded in Java itself. Therefore there should be
a number of clear cases where you can essentially replace slow Groovy
code with faster, more efficient Java code.
This doesn't stop the need for your own benchmarks and profilinhg. If
you benchmark or profile your own application which will have different
characteristics to the ones shown and find that a particular part is
going exceedingly slow, you can, in order from most important to least
important:
a) Determine whether the bottleneck would occur in "reality" and then
determine if spending time optimising it is worth it
b) Determine if the algorithm you've chosen is the most efficient in the
general sense
c) Determine if the algorithm you choose uncovers any current "flaws" in
Groovy's implementation (1)
d) Write the algorithm in Java, benchmark it and then glue it back to
your Groovy code
It's highly unlikely you'll need (e) if you're going to use the JBoss
Seam framework. I am going to assume that you're not going to write
"Breaking 256 AES/Rijndael" with the JBoss Seam framework and Groovy :)
Realistically, Groovy is unlikely to perform as badly as the benchmarks
you've posted state. They would be, I'd suggest, pathological cases and
whilst I used a pithy example in the previous paragraph, you're not
likely going to hit many pathological cases if any. Even if you do hit
one, you could simply farm it out to Java 6.0 but gain the benefits that
Groovy gives.
DSL
(1) EG:
Take this:
int count = 0;
int i = 0;
for (i = 0; i++ < 10000; ) {
++count;
}
System.out.println("Count is " + count);
Clearly that can be optimised to:
int count = 0;
int i = 9999;
count = 10000;
System.out.println("Count is " + count);
I don't know if a non-human optimiser could do that (my hunch is that it
can), but clearly the second way is faster, and ridiculously faster for
Groovy because it avoids the "MOP" + "there are no primitives in Groovy"
issue.
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email