On 03/29/2014 02:55 PM, Paolo Amadini wrote:
With bug 988122 landing soon, you'll now find a "Promise" object
available by default in the global scope of JavaScript modules.

However, this default implementation is still limited, and you're
strongly recommended to import Promise.jsm explicitly in new modules:

   Cu.import("resource://gre/modules/Promise.jsm");

This will give you a number of advantages, among others:
  - Errors don't risk disappearing silently (bug 966452)
  - Tests will fail if errors are accidentally uncaught (bug 976205)
  - You can inspect the current state in the debugger (bug 966471)
  - You can see registered "then" handlers (bug 966472)
  - You get better performance on long Promise chains

Promise.jsm and Promise are still interoperable from the functional
point of view, the difference is in the above non-functional
characteristics. Promise.jsm also has better performance due to the
fact that it avoids the JavaScript / C++ / JavaScript turnaround
time on chain resolution,
Has this shown up in profiles? If so, could you please give links to the 
profiles, since
we should get fast promise handling to the web platform.


with an optimized resolution loop handling
How is this different to the C++ implementation?
Based on the code inspection both seem to do pretty much the same thing.
Post a runnable to the event loop and then process all the callbacks in
on batch.


but I don't think this performance part should prevent us from
migrating to C++ Promises when the other limitations are addressed.

Cheers,
Paolo


_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to