Performance issue while returning a large Object
See original GitHub issueI have a 1.7MB object to send.
Doing this will cause a TTFB time of 330ms (that’s ok) and a Content download time of 4s in Chrome.
router.get('/heavy', async function heavyRoute(ctx, next) {
const result = await collectHeavyData()
ctx.body = result // my 1.7MB object
console.log('less than 100ms and we are here')
})
The same logic written with .NET cause a TTFB time of 2s (that’s ok, my bad) and a Content download time of 92ms.
The response are the same, the Koa route code execute in less than 100ms, but the client get the complete response really slowly.
Am I missing something?
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Returning Large Objects in Functions - c++ - Stack Overflow
The emphasis on a "large object" refers to the fact that repeated copies of the object, unnecessarily, is wasted cycles.
Read more >Where does the performance penalty from returning larger ...
Looking at the assembly generated by MSVC, it appears that it unrolls the loop when your struct has nothing but your float, while...
Read more >bad performance and high memory usage when returning ...
I encountered a performance issue when returning a large array o. ... high memory usage when returning large array of nested objects #2605....
Read more >Pmap extremely slow when function returns large object
I would like to parallelize a function but returning large objects makes pmap extremely slow. using Distributed using SharedArrays ...
Read more >4. Object Creation - Java Performance Tuning, 2nd Edition ...
This class creates and dereferences a huge number of objects while it parses a stream, and the effect is to slow down processing...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
try using streams or a more optimized
JSON.stringify()
moduleI am going to close this issue. Feel free to re-open if you still believe this to be an issue with Koa.