Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use recursive setTimeout instead of setInterval? #1

Closed
Avaq opened this issue Mar 10, 2012 · 1 comment
Closed

Use recursive setTimeout instead of setInterval? #1

Avaq opened this issue Mar 10, 2012 · 1 comment

Comments

@Avaq
Copy link
Owner

Avaq commented Mar 10, 2012

Because setInterval could clog up script execution.

The reason setInterval is bad is because it will try to execute the code every X MS regardless of what's going on in the thread.

@Avaq
Copy link
Owner Author

Avaq commented Mar 11, 2012

Note to self: When this is implemented, it might be worth it measuring the execution time of the progress-callbacks while executing them, so its result can be subtracted from the interval time. We can set this to a minimum interval time to ensure there is nothing from the current interval event left in the thread, but also keep the actual interval time as precise as possible (as would happen when using setInterval over recursive setTimeout).

@Avaq Avaq closed this as completed in 3b4dc3c Mar 12, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant