Why use a Groovy shell script over Bash (when memory footprint is important)?

Viewed 8522

I've got a Bash script (50 lines of code) that requires a bit of hacking due to limitations of bash. So someone said: "hey, use a better language than bash for that!"

So, I looked at Groovy (Groovy/Grails is next up on my to-learn list, so maybe this is a good time). I can do more complex shell scripts, so this might be a perfect fit.

But when I run even a simple Groovy script (while(true){...}) the memory consumption of the Java process is 123M, ouch, I've got about 10 such scripts to run (all bash based now) on a box with 650M of memory. The equivalent stand-alone bash script runs in around 1.5M of memory.

So is this a case of:

  • I'm a newbie doing something wrong, 123M memory footprint is not necessary?
  • Groovy isn't a good fit here? Perhaps Python or Perl are more memory conscious?
  • bash is a good option, even for its shortcomings, when a small footprint is important?
6 Answers
Related