Closed
Bug 910876
Opened 11 years ago
Closed 11 years ago
provide a setImmediate() polyfill
Categories
(Firefox OS Graveyard :: Gaia, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: bkelly, Assigned: bkelly)
Details
(Keywords: perf, Whiteboard: [ c= p=2 u= s=2013.09.06 ])
Attachments
(1 file)
As discussed in the following blog, setTimeout() without a zero delay still incurs a time penalty of about 10ms to 20ms in most browsers:
http://dbaron.org/log/20100309-faster-timeouts
In his blog post, dbaron outlines an alternative way to perform a "next tick" that avoids much of this time penalty.
I believe we already have code using this technique in at least one place:
https://github.com/mozilla-b2g/gaia/blob/master/apps/calendar/js/calendar.js#L172
It would be nice to take advantage of this in other areas as well.
To that end I would like to recommend that we import setZeroTimeout() into shared/js.
Assignee | ||
Comment 1•11 years ago
|
||
Pointer to Github pull-request
Assignee | ||
Updated•11 years ago
|
Assignee | ||
Updated•11 years ago
|
Status: NEW → ASSIGNED
Assignee | ||
Comment 2•11 years ago
|
||
I've updated the pull request with the NobleJS setImmediate() polyfill.
Note, I purposefully did this in two commits so we have the original upstream file in our history before applying our customizations.
I also tried to avoid making non-functional changes. For example, the style of the NobleJS code does not match our gjslint rules. I figured it would be better not to create a lot of churn for style, though, in case we want to import upstream patches in the future.
Please let me know if there is a better way to handle third party vendor code.
Assignee | ||
Updated•11 years ago
|
Summary: consider adding setZeroTimeout() to shared/js → provide a setImmediate() polyfill
Assignee | ||
Updated•11 years ago
|
Whiteboard: [ c= p=1 u= s=2013.09.06 ] → [ c= p=2 u= s=2013.09.06 ]
Assignee | ||
Comment 3•11 years ago
|
||
Comment on attachment 797463 [details]
Pointer to Github pull request: https://github.com/mozilla-b2g/gaia/pull/11849
Tim, since you seemed interested on the mailing list I thought I would add you as the reviewer. Please let me know if you would prefer I ask someone else. Thanks!
Attachment #797463 -
Flags: review?(timdream)
Comment 4•11 years ago
|
||
Ben: Could you mention something like "Remove when bug 686201 lands" in the code?
Assignee | ||
Comment 5•11 years ago
|
||
(In reply to Anthony Ricaud (:rik) from comment #4)
> Ben: Could you mention something like "Remove when bug 686201 lands" in the
> code?
Good idea! Done.
I've also updated the pull request to remove the node.js global compat code, as Kevin requested on Github, and also to better integrate with our units tests by using suite()/test() instead of specify().
Comment 6•11 years ago
|
||
Comment on attachment 797463 [details]
Pointer to Github pull request: https://github.com/mozilla-b2g/gaia/pull/11849
I did not see Vivien respond to the thread (since he was on vacation), so let's make sure his preference here before landing.
Attachment #797463 -
Flags: review?(timdream)
Attachment #797463 -
Flags: review+
Attachment #797463 -
Flags: feedback?(21)
Comment 7•11 years ago
|
||
Comment on attachment 797463 [details]
Pointer to Github pull request: https://github.com/mozilla-b2g/gaia/pull/11849
As long there is a bug number and people are commenting on it to get a real implementation I'm fine with using a shim.
Attachment #797463 -
Flags: feedback?(21) → feedback+
Assignee | ||
Comment 8•11 years ago
|
||
Thank you for the quick review and feedback! Merged:
https://github.com/mozilla-b2g/gaia/commit/268309cccd30c84b065e2daa64dda34442a7155c
I will send a follow-up email to dev-gaia later today.
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Comment 9•11 years ago
|
||
removing koi? flag since it has been set up by mistake, sorry for the inconvenience
blocking-b2g: koi? → ---
You need to log in
before you can comment on or make changes to this bug.
Description
•