Interpreter startup times benchmark
2024-04-20
Which scripts start fastest?
Have you ever thought about which scripting language to use for a specific task? Sometimes any language will do. Sometimes you have no choice. But whenever you can choose, there are multiple factors to consider. One of them is fast execution. Usually this doesn't matter so much, like in an automation pipeline. But it can make a difference for scripts that are run often, p.e. on a certain key combination configured in sxhkd.
Fast execution depends on two factors: Interpreter startup time and the actual code execution time.
For small wrapper scripts, the interpreter startup might take longer than the code execution.
It's possible that in the end you don't feel a difference at all between a faster and a slower scripting language. But I was curious nevertheless. That's why I made a little benchmark: I have written a shell script that starts different script interpreters with empty scripts 30 times each and another one to plot the results.
The startup times range from 0.33 to 890 milliseconds. All results in a single plot with a logarithmic scale:
For more plots, remarks and the original scripts have a look at github.com/MaxGyver83/interpreter-startup-times.