Goal: Soundly Defeat Bash in Performance
There are a few areas in the shell that could use some optimizations to better compete with other established shells. Here are some optimizations that I can think of that would be beneficial and not too complicated to implement.
-
Implement echo, test, and other essential commands. -
When creating a new Job structure, the structure should contain both the original arguments, set to private, and a tokenized variant that self references to the original arguments. This could probably be achieved using the rental crate. In any case, without this optimization, each loop through a set of statements requires re-tokenizing arguments. -
Statements contained within loops should be collected and reused, rather than having to recollect a copy of each statement for each loop. -
JIT-compile scripts into an IR representation, and cache this IR for future runs. Basically, this would allow the ability to skip much of the parsing and validation for future runs of the same script. Compare the hash and filename of the script, and if the hash and filename match an existing pre-compled script, load the Statements from that script and execute it.