0

According to this Wikipedia article: List of command-line interpreters there is more than a dozen command-line interpreters.

Which one is most efficient in a term of performance. Why should I use something else then standard bash?

I am not asking about "fundamental difference" between *NIX shells as I cannot find nothing about performance there.

I am simply asking if you run same code (if it's compatible) with different Shell interpreter on the same hardware, would it be some difference in performance?

  • 5
    If your script relies on the speed of interpretation of the shell, then you're letting the shell do too much, or you use the shell in the wrong way. – Kusalananda Sep 20 '17 at 12:47
  • 2
    Start up speed is one reason why /bin/sh on debian based system is dash. For more details, see for example Why this change was made? on ubuntu wiki. – sebasth Sep 20 '17 at 12:52
  • ksh93 is alleged to be faster than Bash while providing a similar feature set, from a scripting standpoint, but I don't know of a well-regarded shell benchmarking suite. I'm with Kusalananda: if you need it to be fast, why are you using shell? – Warren Young Sep 20 '17 at 13:31
  • 2
    Terms of what speed? Runtime? Development? Both aggregated over a script's lifetime? – Chris Davies Sep 20 '17 at 13:34
  • @Kusalananda exactly! I just need to follow "general rules" of my company. As we use bash to write custom scripts for Icinga monitoring. I have figured that same script (with more or less same logic) that is written in php is about 300% faster! So because i need to follow these rules and to take care of server resources, I am asking with which interpreter I would get best performance – spaceman117X Sep 20 '17 at 13:41
  • Wait, wait wait: they're willing to let you install any shell you tell them is fastest, based apparently on our answers here, but you can't write it in any other language for the same reason? They won't accept, say, "Perl" as a better answer? (Just to pick one very popular systems administration focused scripting language that is likely to beat the pants off any given shell script interpreter.) – Warren Young Sep 20 '17 at 13:47
  • That is exactly my point! I think that team leader who is responsible of checking all code that is about to be put into production, does not want to be bothered with all kinds of supported script languages (I like php, other guy Python, third Perl). So obviously this unification is more important to him than performance. – spaceman117X Sep 20 '17 at 14:04
  • I think you need be more specific on what you mean by performance. Some shells can be faster in one aspect while slower in another. – sebasth Sep 20 '17 at 14:43
  • Also note that the same (POSIX) script will usually run faster in XYshell than in bash, but by using some bash extensions you could get even faster. – Philippos Sep 20 '17 at 14:46
  • "Some shells can be faster in one aspect while slower in another" Yes, I would love to read some article online about this, but apparently I have not found anything online. – spaceman117X Sep 20 '17 at 14:47
  • Regarding your recent addition to the question: Nobody can tell you without looking at the code. – Kusalananda Jan 24 '18 at 13:08
  • Yes, thanks @Kusalananda, I just thought someone has some insights on this. I will run some test on my own, something like Fibonacci sequence or something and I will post results here. – spaceman117X Jan 24 '18 at 13:16
  • @spaceman117X Something like that should really not be done in the shell though, but by a C program (or similar). – Kusalananda Jan 24 '18 at 13:17
  • yes, but I am interested in comparing performance of same algorithm on different Shell Interpreters. – spaceman117X Jan 24 '18 at 13:21

0 Answers0