note 118258 added to function.usleep

From: Date: Wed, 04 Nov 2015 19:26:27 +0000
Subject: note 118258 added to function.usleep
Groups: php.notes 
Request: Send a blank email to php-notes+get-204084@lists.php.net to get a copy of this message
On both MacOS X and Linux the usleep() call seems to consume CPU cycles, whereas sleep() and time_nanosleep() do not. This was the same on PHP 5.3.29 and 5.5.29. I used a loop with just a call to sleep/usleep/time_nanosleep, and compared them all with an empty loop. Obviously the empty loop consumed 99% of the CPU, sleep used 0%, usleep used 3% for 1000ms and 6% for 100ms, and time_nanosleep used 0% for both 500ms and 1000ms. ---- Server IP: 72.52.91.14 Probable Submitter: 68.114.34.10 ---- Manual Page -- http://php.net/manual/en/function.usleep.php Edit -- https://master.php.net/note/edit/118258 Del: integrated -- https://master.php.net/note/delete/118258/integrated Del: useless -- https://master.php.net/note/delete/118258/useless Del: bad code -- https://master.php.net/note/delete/118258/bad+code Del: spam -- https://master.php.net/note/delete/118258/spam Del: non-english -- https://master.php.net/note/delete/118258/non-english Del: in docs -- https://master.php.net/note/delete/118258/in+docs Del: other reasons-- https://master.php.net/note/delete/118258 Reject -- https://master.php.net/note/reject/118258 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#204084) next »