Jun 14, 2008

Is Groovy Too Slow?

Is Groovy too slow? Certainly I found it too slow for intensive number crunching. Once I started to need multiple passes over every pixel in a 640x480 image for my image processing app things got to be too slow for my needs. That's when I had to grudgingly admit that Groovy wasn't the best tool for the job, and wrap up the logic in a Java class.

2 comments:

patrickdlogan said...

I heard the latest beta is a good bit faster. Still may not address your specific need in this case though, which could have more to do with boxing and unboxing thousands of pixels in an image. Not sure how you rewrote this in Java, e.g. all the code, or just the specific image manipulation code. Dynamic languages on other VMs, e.g. Gambit Scheme, come with specific "built-in" data types and functions for manipulating arrays of "primitive" values, just because this kind of boxing and unboxing always interferes with big-grid-of-primitives manipulation.

Merlyn Albery-Speyer said...

That's encouraging about the beta.

I guess my post was a little irresponsible. If I wasn't so lazy I would isolate just the code in question and profile it in Groovy to see where the time was going. My guess* is that the time is going into calling the closure inside the loop over and over.

* See? I'm guessing.