Closed
Description
There is very simple way to speed up StreamSelectLoop, because usleep(0) not skipping sleep, cuz it function call;
$t = microtime(true);
usleep(0);
$r = microtime(true);
echo ($r-$t)*1000000; //69.856643676758
vs
$t = microtime(true);
0 && usleep(0);
$r = microtime(true);
echo ($r-$t)*1000000; //5.9604644775391
So in the cycle with timeout in variable
$timeout = 0;
$start = microtime(true);
for($i = 0; $i < 100000; $i++) {
usleep($timeout);
}
echo microtime(true) - $t; //6.6996
vs
$timeout = 0;
$start = microtime(true);
for($i = 0; $i < 100000; $i++) {
$timeout && usleep($timeout); //skip null and 0 sleeps
}
echo microtime(true) - $t; //0.026
Metadata
Metadata
Assignees
Labels
No labels