-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[feature request] Consideration of using async / await #3328
Comments
Agree. Performance is always the key improvement for Hexo. IMHO, this is not a feature, more like an enhancement. Anyway, thanks for bringing this up. |
I agree. Same as other hexo repositories. |
Just started working on this. A few observations:
|
https://blog.kuzzle.io/bluebird-vs-native-vs-async/await-state-of-promises-performances-in-2019
And according to the hexo's benchmark from some related PR, currently I see no performance gained through replacing |
The benchmark linked by OP only shows async/await being slightly faster than bluebird (in sequential), the difference looks to be within margin of error. I still believe bluebird is faster currently and for a foreseeable future; even our benchmark doesn't show it's faster in Node 13. Perhaps there may be bottleneck somewhere that either approach (bluebird/native) doesn't make any difference. At the same time, async/await is significantly more readable, so if the perf is not affected, let's use it. especially for unit tests, where perf doesn't matter much. |
How about deprecating - View.prototype.render = function(options, callback) {
+ View.prototype.render = function(options) {
- if (!callback && typeof options === 'function') {
- callback = options;
- options = {};
- }
options = options || {}; And I found only a few examples of using callbacks as asynchronous at https://hexo.io/api/. |
Here we are, 2020's benchmark: https://blog.kuzzle.io/bluebird-native-async_await-javascript-promises-performances-2020 Performance of sequential promises Performance of parallel promises Also, there goes the interesting discussion: nodejs/node#33384 TL, DR Bluebird appears to be consistently faster. |
For feature request
The native promise after node v10 is fast enough.
Since
async
/await
is supported in node v7 or later, it can be used when support of node v6 LTS (maintenance) is turned off.Using
async
/await
tends to make the code simple, and sequential asynchronous is faster thanbluebird
on thebluebird
side benchmark (in the case of parallel, nowbluebird
is faster).The text was updated successfully, but these errors were encountered: