-
Notifications
You must be signed in to change notification settings - Fork 237
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
question. How setImmediate
improve performance?
#23
Comments
Hi @ChangJoo-Park. Nice that you checked :) To be honest I've not clear idea why. But you can try
What is you node version and testing method? For me it was order of 15 percent in node 14 |
Thank you for reply! I retry with
Before I try I saw only throughput. It slightly same. weird result express with setImmediateh3's the way of return response is just return something, It is not same with express. So. I try express with this code. always 'just res.send' faster than with setImmediate. app.get('/', (req, res) => {
return res.send({ hello: 'world' })
}) app.get('/', (req, res) => {
setImmediate(() => res.send({ hello: 'world' }))
}) |
h3 use promise with setImmediate for nitro at this time. I understood this issue. |
Hello @pi0 . I can not find for place to question. So I leave my question here.
I saw yesterday your commit. I understood early return (break to return) is nice pattern in the upper diff
src/app.ts
.but, I didn't understand to use
setImmediate
. All of request already asynchronous. Why needPromise
withsetImmediate
?I tried to benchmark before / after
setImmediate
. I got almost same result.The text was updated successfully, but these errors were encountered: