Hacker News new | ask | show | jobs
by HumanOstrich 804 days ago
Can you give an example? I just think that no matter what programming language or framework you're using, if you are querying for giant arrays through an ORM and passing them through an API result to a web app, it's going to be slow.

There are other kinds of solutions for this problem like breaking up the data into chunks and only returning the necessary data. Maybe it's a DB optimization where you can add indexes. Or caching the result of your ORM query.

I've never seen any web app written with any tech that was snappy while making requests for large amounts of data and waiting for it to come back in one big honkin array.

> Web apps deal with fairly big data structures, if nothing due to orms.

Perhaps due to using ORMs unnecessarily and/or inefficiently and failing to drop down to SQL when needed.

1 comments

It's hard to think about an example, this is very application specific. But there are background jobs and that's where a big array could be manipulated
Probably still need to stream or chunk the data instead of dealing with giant arrays to get decent performance. That's not a language/platform issue.

I recently had to process and aggregate metrics for 5 million rows of user data (a few GBs) on my MacBook with Node.js. By streaming / iterating over the items without loading them all at once it chewed through them all in a few seconds. ¯\_(ツ)_/¯ And it's single-threaded (except for I/O offloaded to threads -- I'm talking about the calculations).