There is very simple way to speed up StreamSelectLoop, because usleep(0) not skipping sleep, cuz it function call; ``` php $t = microtime(true); usleep(0); $r = microtime(true); echo ($r-$t)*1000000; //69.856643676758 ``` vs ``` php $t = microtime(true); 0 && usleep(0); $r = microtime(true); echo ($r-$t)*1000000; //5.9604644775391 ``` So in the cycle with timeout in variable ``` php $timeout = 0; $start = microtime(true); for($i = 0; $i < 100000; $i++) { usleep($timeout); } echo microtime(true) - $t; //6.6996 ``` vs ``` php $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 ```
Activity
Fixes issue reactphp#36
Merge pull request #37 from greevex/greevex-issue-36
cboden commentedon Mar 3, 2016
Fixed via #37. Thanks!