Open Bug 1371287 Opened 7 years ago Updated 2 years ago

PromiseWalker#scheduleWalkerLoop() seems to create unnecessary bound and arrow functions

Categories

(Toolkit :: Async Tooling, enhancement)

enhancement

Tracking

()

People

(Reporter: anba, Unassigned)

Details

http://searchfox.org/mozilla-central/rev/1a054419976437d0778a2b89be1b00207a744e94/toolkit/modules/Promise-backend.js#742-743 binds |walkerLoop| to the this-value, but, assuming this is the same |walkerLoop| from here http://searchfox.org/mozilla-central/rev/1a054419976437d0778a2b89be1b00207a744e94/toolkit/modules/Promise-backend.js#787, |walkerLoop| is already bound to the PromiseWalker object here http://searchfox.org/mozilla-central/rev/1a054419976437d0778a2b89be1b00207a744e94/toolkit/modules/Promise-backend.js#812. Rebinding the function creates unnecessary objects and forces the js-engine to atomize the bound function names repeatedly. Similarly, this arrow function http://searchfox.org/mozilla-central/rev/1a054419976437d0778a2b89be1b00207a744e94/toolkit/modules/Promise-backend.js#746 could be removed, because |this.walkerLoop| is already bound to the PromiseWalker.
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.