Re:Bashing the Bash – Replacing Shell Scripts with Python (2...
by kaba0 on Saturday March 26, 2022 @01:37PM
(#30813706)
How is bash performant? It is literally interpret by lines, and starting a whole process per if statements..
[ Parent
| on HN ]
Re:Bashing the Bash – Replacing Shell Scripts with Python (2...
by bdowling on Sunday March 27, 2022 @02:53AM
(#30818304)
> How is bash performant?
Typically, time spent interpreting control flow in a bash script is dwarfed by time spent in the programs called by the script.
> It is literally interpret by lines
It's just splitting lines into words to build up commands. It's not compiling C++.
> starting a whole process per if statements..
In the common pattern `if command1; then command2; fi`, if command1 is a builtin (e.g., `test` or `[`), then bash does not create a subprocess.
Re:Bashing the Bash – Replacing Shell Scripts with Python (2...
by kaba0 on Sunday March 27, 2022 @04:55AM
(#30818786)
Still doesn’t make it fast in any meaning of the word, which was my original criticism.
Re:Bashing the Bash – Replacing Shell Scripts with Python (2...
by bdowling on Sunday March 27, 2022 @01:37PM
(#30822185)
You asked how bash is performant. I responded with reasons its performance is good in many applications. Here”s one more: bash starts up faster than other interpreters (e.g., Python), and startup time can often be a significant factor in overall performance.