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

[3.x] Fast forward resolved/rejected promises with await #22

Conversation

WyriHaximus
Copy link
Member

This makes awaiting an already resolved promise significantly faster.

Ported from: #18

@WyriHaximus WyriHaximus added this to the v3.0.0 milestone Jan 10, 2022
@WyriHaximus WyriHaximus requested review from jsor and clue January 10, 2022 07:47
@WyriHaximus WyriHaximus force-pushed the 3.x--fastforward-resolved-promise branch from b67fea3 to cd54e6d Compare January 17, 2022 13:11
src/functions.php Outdated Show resolved Hide resolved
@WyriHaximus WyriHaximus force-pushed the 3.x--fastforward-resolved-promise branch 2 times, most recently from 584e5b0 to aa33246 Compare January 25, 2022 16:02
@WyriHaximus WyriHaximus force-pushed the 3.x--fastforward-resolved-promise branch 3 times, most recently from 67d87b0 to b9e36aa Compare February 11, 2022 17:57
This makes `await`ing an already resolved promise significantly faster.

Ported from: reactphp#18
@WyriHaximus
Copy link
Member Author

After discussing this PR with @SimonFrings and @clue we came to the conclusion that porting #18 to #21 and this PR doesn't introduce only more code and no performance gainst at all. We got a bit excited about the idea of doing this without realizing this makes the function more complex while the loop would instantly be stopped anyway. And that fraction of a millisecond gain we might get from doing this is not worth it. It was however very much worth doing this for fibers in #18.

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

Successfully merging this pull request may close these issues.

2 participants