[Swan-dev] updown overhead: bash is fast!

D. Hugh Redelmeier hugh at mimosa.com
Mon Oct 8 15:28:15 UTC 2018

programs/_updown.netkey/_updown.netkey.in is 830 lines of shell code.  I 
worried that this would impose a lot of overhead.  The original FreeS/Wan 
one was *much* shorter.

It turns out that BASH on my desktop is really quite fast (Fedora 28
on i7-4770).

[hugh at redeye libreswan]$ time sh ./programs/_updown.netkey/_updown.netkey.in silly
./programs/_updown.netkey/_updown.netkey.in: Unknown argument "silly"

real	0m0.003s
user	0m0.002s
sys	0m0.001s

(I admit that this is not the first run, so things are in the cache,
but I think that will generally be the case in actual use.)

This looks very reasonable.  This does not seem worth optimizing.

Just for fun, here are the times for the same script, but with comment
lines deleted (leaving 648 lines):

real	0m0.002s
user	0m0.001s
sys	0m0.001s

More information about the Swan-dev mailing list