Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Conversation

JiaLiPassion
Copy link
Collaborator

in zone.js we use native Promise when available to run microTaskQueue. in current version, we call

global[symbolPromise].resolve(0)[symbolThen](drainMicroTaskQueue);

so we will create a new native promise every time, in fact we only need to schedule a native async micro task to make sure drainMicroTaskQueue run async and run asap, we can reuse the promise for better performance.

if (!nativeMicroTaskQueuePromise) {
        if (global[symbolPromise]) {
          nativeMicroTaskQueuePromise = global[symbolPromise].resolve(0);
        }
      }
      if (nativeMicroTaskQueuePromise) {
        nativeMicroTaskQueuePromise[symbolThen](drainMicroTaskQueue);
     } ...

@mhevery mhevery merged commit 7ee8bcd into angular:master Aug 23, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants