Just to write this down somewhere... the adding paths and searching (as 
compared to just appending PATH=$PATH:/usr/bin:....) doesnt cost a lot of time.

### Running ":" 100k times as benchmark
$ time sh /tmp/my.sh "/my/random:/path:/here" : $(seq 1 100000)

real    0m0.162s
user    0m0.133s
sys     0m0.032s

### Running ensure_sane_path 100k times.
$ time sh /tmp/my.sh "/my/random:/path:/here" ensure_sane_path $(seq 1 100000)

real    0m0.586s
user    0m0.543s
sys     0m0.045s

### Run with a larger input path.
$ time sh /tmp/my.sh "$PATH" ensure_sane_path $(seq 1 100000)

real    0m0.635s
user    0m0.611s
sys     0m0.026s

So the cost of 100000 runs of ensure_sane_path is somewhere in the realm
of .5 seconds.  That is .000005 for the one run we'll do.

very small.

Your team cloud-init commiters is requested to review the proposed merge of 
~smoser/cloud-init:fix/1771382-ds-identify-ensure-sane-path into 

Mailing list: https://launchpad.net/~cloud-init-dev
Post to     : cloud-init-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~cloud-init-dev
More help   : https://help.launchpad.net/ListHelp

Reply via email to