Switching to async/await from Task.jsm/yield

Ehsan Akhgari ehsan.akhgari at gmail.com
Fri Mar 17 23:30:46 UTC 2017


On 2017-03-16 6:29 PM, Dave Townsend wrote:
> For a long time now we've been writing JS code that waits for promises
> using Task.jsm and generator functions. Recently though the JS team
> added support for the JS standard way of doing this, async/await:
> https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function
> 
> Writing code in standard JS is always better for the web, makes it
> easier to onboard new engineers and allows for better support in
> developer tools. So I'd like to propose that we switch to the standard
> way of writing these functions immediately. New code should use
> async/await instead of Task.jsm going forwards.
> 
> Florian has some rough plans to automatically rewrite existing usages of
> Task.jsm to the standard JS forms so for now don't worry much about
> going and submitting patches to fix up existing code. Once that is done
> we can remove Task.jsm from the tree.
> 
> Does anyone object to any of this?

Have we measured the performance of our async/await implementation?  I
think we should definitely do some extensive testing of the performance
of any new ES primitives before deciding to switch to using them in the
front-end code en masse.  Of course, if the performance result aren't
good, that doesn't mean we shouldn't use them in the front-end code, it
means we need to make the performance better.  :-)  But we need to be
able to make the trade-off cautiously.

On the plus side, I sometimes really struggle to read the profiles when
looking at the JS call stacks involving Task.jsm primitives, so moving
away from them sounds really exciting to me personally!

Thanks,
Ehsan




More information about the firefox-dev mailing list