Someone posted a comment in the php usleep manual that usleep() consumes CPU cycles whereas sleep() and time_nanosleep() do not. Is this true for PHP 7.x?

Re: Does usleep consume CPU cycles? 80 80

I am not an expert on this but recall a few things. First, implementation, version and host OS dependent so you can not make a blanket statement except there are cycles consumed in any sleep() I've seen in decades. Now are said cycles consumed in sleep() entirely? Back to implementation, OS etc.

There are long priors here with lots of testing showing different results from different OSes including said Mint version X.YZ vs. X.YY.

And it gets very hard to measure with multiple core hosts. Sorry if this doesn't help. My thoughts here are only to share that the answer is not black and white or yes/no.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.