logoalt Hacker News

tim333yesterday at 7:53 PM1 replyview on HN

The behaviour is a bit weird - I just opened mine and in Chrome task manager it showed the ram use climbing to 2.8GB, but in the network console it only shows a few 10s of mb download. I wonder what the discrepancy is? The site seemed to notice the console was open and behaved differently also.


Replies

throwaway_19szyesterday at 8:20 PM

I think that’s normal, I would expect RAM use to dwarf network transfer on most modern JS-heavy sites.

If a page downloads 1MB JSON, that could easily take 10MB (maybe much more?) RAM when parsed into an object. And JS code itself probably has a similar increase in size just by getting parsed into an AST. And all that is before really executing anything - once the dozens of shitty third party scripts start whirring, they will generate tons of uncollectible garbage because they are written by miserable people who don’t give a shit, understandably. And I bet LinkedIn has a hell of a lot of junk third party scripts injected by random spies I working in various corporate departments who need to spy on users to collect data to persuade their boss to let them do some dumb project to prove they deserve their job.

Tabs also render a bunch of compositor layers as bitmaps stored in VRAM, or just RAM, for smooth scrolling. Oh and there’s the DOM, I bet that adds up. I’m probably only scratching the surface. There’s so much going on in a browser tab. The front end is a marvel of engineering. Sites like LinkedIn of course exploit this for banal evil, sadly.

show 1 reply