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

Use native Promises #9660

Closed
jryans opened this issue May 9, 2019 · 9 comments
Closed

Use native Promises #9660

jryans opened this issue May 9, 2019 · 9 comments
Assignees
Labels
T-Task Tasks for the team like planning

Comments

@jryans
Copy link
Collaborator

jryans commented May 9, 2019

All of our supported browsers (as well as Node.js) have supported native Promises for a while. We should remove userland Promise libs (like bluebird) and convert to native instead.

@jryans jryans added T-Task Tasks for the team like planning Help Wanted Extra attention is needed labels May 9, 2019
@t3chguy
Copy link
Member

t3chguy commented May 9, 2019

benchmarks still tend to show bluebird as performing better than native promises: https://gist.github.com/joseluisq/a87adfd46d86d82ba787919a062f6e36

@jryans
Copy link
Collaborator Author

jryans commented May 9, 2019

benchmarks still tend to show bluebird as performing better than native promises: https://gist.github.com/joseluisq/a87adfd46d86d82ba787919a062f6e36

The recent comments there seem to say native is fastest...?

@t3chguy
Copy link
Member

t3chguy commented May 9, 2019

I somehow completely missed that, also stated in the bluebird README:

Promises in Node.js 10 are significantly faster than before. Bluebird still includes a lot of features like cancellation, iteration methods and warnings that native promises don't. If you are using Bluebird for performance rather than for those - please consider giving native promises a shot and running the benchmarks yourself.

@turt2live
Copy link
Member

fwiw we do use the cancellation features of bluebird in the js-sdk

@jryans jryans removed the Help Wanted Extra attention is needed label May 9, 2019
@ara4n
Copy link
Member

ara4n commented May 9, 2019

yup, cancellation features are used for cancelling file uploads iirc

@jryans
Copy link
Collaborator Author

jryans commented May 10, 2019

Hmm, I don't think I am seeing obvious calls to cancel on promises so far... Could someone link to an example of where it's being used?

@t3chguy
Copy link
Member

t3chguy commented Nov 1, 2019

Cancellations are the least of what we use.

Things like Deferreds, mapSeries etc are simple to transition
Things like .value() (a sync way of getting the fulfilled value) and isFulfilled() which the code claims we use for performance (to save it being thrown onto the next event loop when it is already done) are much harder. This is a gargantuan task.

@t3chguy
Copy link
Member

t3chguy commented Nov 21, 2019

react-sdk changes have landed, js-sdk and riot-web due.

@t3chguy
Copy link
Member

t3chguy commented Dec 11, 2019

Fixxxxxed :D

@t3chguy t3chguy closed this as completed Dec 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-Task Tasks for the team like planning
Projects
None yet
Development

No branches or pull requests

4 participants