3 ms·
I'm showing 20-200ms longer on first run of the exec. Modified the test script a bit to show that it doesn't happen again if you modify the executable's content
by parhamn 6y ago
I'm showing 20-200ms longer on first run of the exec. Modified the test script a bit to show that it doesn't happen again if you modify the executable's contents.
echo $'#!/bin/sh\necho Hello' > /tmp/test.sh && \
chmod a+x /tmp/test.sh && \
time /tmp/test.sh && \
time /tmp/test.sh && \
echo 'echo Hello2' >> /tmp/test.sh && \
time /tmp/test.sh
- eugenekolo 6y agoAnother slight modification to make this show the effect every time: f=$(mktemp) && \ echo $'#!/bin/sh\necho Hello' > $f && \ chmod a+x $f && \ time $f && \ time $f && \ echo 'echo Hello2' >> $f && \ time $f On my system: Hello real 0m0.131s user 0m0.001s sys 0m0.002s Hello real 0m0.004s user 0m0.001s sys 0m0.002s Hello Hello2 real 0m0.004s user 0m0.001s sys 0m0.002s