You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Just a thought for an easy speed boost. The cost of calling sh -c isn't negligible on very large builds:
$ time sh -c 'for i in $(seq 0 10000); do /bin/true; done'
'for i in $(seq 0 10000); do /bin/true; done' 2.53s user 2.55s system 113% cpu 4.482 total
---------------------------------------------------------------------------------------------------
$ time sh -c 'for i in $(seq 0 10000); do sh -c /bin/true; done'
'for i in $(seq 0 10000); do sh -c /bin/true; done' 6.03s user 7.70s system 104% cpu 13.210 total
The number of special characters in POSIX shell is well defined so such check should be fairly simple.
The cost of character comparison shouldn't be greater than the cost of the exec indirection but if that's a worry for you, you can simply bypass the comparison when the command is above a certain length threshold