Friday, March 2, 2018

Pausing with sleep for 1/100 of a second

So I wanted have a script pause for 1/100 of a second using sleep, but it seemed to have a bit of overhead.

A little bash script to test it says that I should sleep for about 0.0084 seconds to get an effective 0.01 second delay.

It's a little tricky to get those bash one-liners right with ifs and having to put semicolons in just the right places to parse correctly.


This is with Ubuntu 17.10.


Also, why don't we measure how much overhead there actually is for a "sleep 0" command.

A lua5.3 one-liner is:


and why don't we try it with bash with a sleep 0:

No comments:

Post a Comment