> You're whacking moles. Use a profiler. That's what they're for. I've already shown that $() is a major problem to slow down the speed and I have reduced using its usage in my code and significantly improved the performance. Nevertheless, it doesn't mean that it is not necessary to systematically evaluating features that are used frequently.
> Yes, I can. You need to identify where bash is _actually_ spending most > of its execution time, and a profiler can help you do that. Yes and no. For a particular bash script, you can quantify which bash features are the most time-consuming. But you can not profile all the bash scripts that have ever been written. Since there are only limited features in bash, in this case, a logical way to go is to at least profile each commonly used feature with minimal code (as just for and repetitive calling that features as I do) and understand its pros and cons. A profiler is an overkill in this case. -- Regards, Peng