Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance Issues because of AbortSignal (Execution Cancellation Plugin) #6791

Open
pozylon opened this issue Dec 21, 2024 · 4 comments
Open

Comments

@pozylon
Copy link
Contributor

pozylon commented Dec 21, 2024

This line here likely makes yoga 10x slower because it almost spends all of it's time adding event listeners when an AbortSignal is provided through the execution context. I just wanted to share my finding here and I'm currently looking for a solution and I don't have an idea yet how to fix that...

signal?.addEventListener('abort', () => {

Maybe it's some kind of regression because of this commit here: 020b9e47b51f9847bf915d ?

Bildschirmfoto 2024-12-21 um 17 22 51 Bildschirmfoto 2024-12-21 um 17 23 15
@pozylon
Copy link
Contributor Author

pozylon commented Dec 21, 2024

Of course i'm doing some artifical request here but still the effect is dramatic the more objects there are in the response:

Response time of that API Request above with useExecutionCancellation(): ~4000ms
Response time of that same API Request without useExecutionCancellation(): ~900ms

Bildschirmfoto 2024-12-21 um 17 41 21

@pozylon pozylon changed the title Performance Issues because of AbortSignal Performance Issues because of AbortSignal (Execution Cancellation Plugin) Dec 21, 2024
@ardatan
Copy link
Owner

ardatan commented Dec 24, 2024

Could you test with the following alpha?
@graphql-tools/executor | 1.3.10-alpha-20241224080220-7cec9a36c8869567ca685def6970f80d29f8b7f5

@pozylon
Copy link
Contributor Author

pozylon commented Dec 27, 2024

Bildschirmfoto 2024-12-27 um 17 03 06 Bildschirmfoto 2024-12-27 um 17 03 58

much better !!

@pozylon
Copy link
Contributor Author

pozylon commented Dec 27, 2024

This shaves off another few milliseconds btw:

 //const promises = Promise.all(Object.entries(object).map(async ([key, value]) => {
  //    resolvedObject[key] = await value;
  //}));
  const promises = Promise.all(Object.keys(object).map(async (key) => {
      resolvedObject[key] = await object[key];
  }))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants