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:
If memory is limited like that, then any language running on the JVM will be at a disadvantage. And Groovy is such a language.
Other languages like Python or Perl have a leaner runtime and require less memory for simple scripts (my guess is that Python is still a bit leaner than Perl, but I can't back that up with numbers).
In my opinion Python is a nice step-up from bash scripts, providing much nicer features while still being lean enough to be used in common scripts.
bash itself is a nice scripting language with a reasonable memory requirement. If memory footprint is really important, than another POSIX-compliant shell (such as dash) might be a reasonable replacement. Note that many, but not all features of bash
are present in modern POSIX-compliant Shells.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With