Jump to content

Recommended Posts

Posted

Here's what i was kinda getting at I guess:

Sleep(0) simply yields process the priority given to it by the windows process manager, if another application has something to do, it would, but if not it will happily chug away at the iteration of it's public facing while loop. Sleep(1) or greater actually idles the CPU (it does nothing, which would probably give some efficiency gains like AdmiralAlkex said). Higher sleep values force it to idle for longer, but within the context of an AutoIt Script, values are only accurate to about 10ms. The only real gain from higher values is more energy efficiency at the cost of less responsiveness. Long story short:

Sleep(0) for real-time responsiveness while not 'hogging' the CPU.

Sleep(1) if you want that part of your script to purposefully idle the CPU, giving other processes 'priority'.

Sleep(250-750) for near- instant responses while still energy efficient and processing friendly (somewhat arbitrary values, everything is relative).

Anything higher is just a matter of how responsive you need it to be vs how much idles time you give the CPU.

Posted

Just some additional info I found interesting in relation to

  On 7/13/2010 at 5:57 PM, 'evilertoaster said:

Sleep(0) for real-time responsiveness while not 'hogging' the CPU.

Sleep(1) if you want that part of your script to purposefully idle the CPU, giving other processes 'priority'.

Priority-induced starvation: Why Sleep(1) is better than Sleep(0) and the Windows balance set manager

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...