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

Define the behavior of Timers with very short intervals #5692

Closed
justinfagnani opened this issue Oct 5, 2012 · 3 comments
Closed

Define the behavior of Timers with very short intervals #5692

justinfagnani opened this issue Oct 5, 2012 · 3 comments
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. closed-not-planned Closed as we don't intend to take action on the reported issue library-isolate

Comments

@justinfagnani
Copy link
Contributor

In browsers the minimum interval is 4ms. Should Timer adhere to that in Dartium and standalone? The behavior should be documented at the very least.

@dgrove
Copy link
Contributor

dgrove commented Jan 11, 2013

Added Library-Isolate label.

@dgrove
Copy link
Contributor

dgrove commented Jan 11, 2013

Removed Library-Isolates label.

@lrhn
Copy link
Member

lrhn commented Dec 11, 2014

I don't think we should reduce the precision of timers on other platforms to match the limits of browser timers.

The problem with faster timers in browsers, as I understand it, was that JS programmers used zero-duration timer in order to get a timer callback "as fast as possible", but their code wasn't really build to work with <=1ms intervals, and it caused unnecessarily large power consumption on existing pages.

Dart code is unlikely to use that approach, since we have better primitives (like microtasks) and perhaps even timers that are already faster than 4ms in Dartium.

We can't document what the timer granularity is in general. It depends on the platform that Dart is running on, and how it's configured (high-resolution timers may be a system-wide setting).

So, no to to Timer restricting itself to existing browser JS behavior.
For documentation, the best we can say is that the granularity depends on the platform, system and configuration it's running on - which is really nothing.
We do write "Note: If Dart code using Timer is compiled to JavaScript, the finest granularity available in the browser is 4 milliseconds.".
I think we'll keep it at that.


Added NotPlanned label.

@justinfagnani justinfagnani added Type-Defect area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-isolate closed-not-planned Closed as we don't intend to take action on the reported issue labels Dec 11, 2014
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. closed-not-planned Closed as we don't intend to take action on the reported issue library-isolate
Projects
None yet
Development

No branches or pull requests

3 participants