why do web browsers use so much ram, while the average size of an entire webpage is 2mb?

651 views

From what I understand, one could cache 100 web pages (obviously, 2mb is average, but there are much smaller and much larger than that) in about 200mb. 1GB could cache literally 500 web pages.

How come web browsers use so much ram then?

In: 3000

25 Answers

Anonymous 0 Comments

Why does Microsoft Word use so much ram if I only type Hello World?

Because a program is not the same as a document in it.

Anonymous 0 Comments

Because web designers are incapable of exercising restraint and they jam dozens of js trackers and ad bullshit into every page. Facebook’s frontend engineers are war criminals

Anonymous 0 Comments

First of all, Chrome separates out each tab into its own memory space, to ensure that one shitty website doesn’t freeze up the entire browser, or even your entire computer. Second of all, and more importantly, *Javascript* is why. The code that runs the page may be 2 MB, but badly optimized software can bloat out to arbitrary size in runtime, and since the website maintainer doesn’t pay for your computer, they have little incentive to ensure it’s efficient.

Anonymous 0 Comments

I’ll add to this:

– modern browsers have to support a wide spectrum of functionality, defined in specifications. Some specifications go back twenty or thirty years but must still be accounted for.

– even something as simple and basic as drawing text or drop shadows is a surprisingly complicated function, involving a lot of math and behind the scenes optimization to keep it smooth.

– people demand more and more out of websites than ever these days, so it’s worth spending ram to reuse calculations or effects.

Anonymous 0 Comments

The plans for a house are drawn on a piece of paper, yet the house takes up so much more space.

The website code is just the plan, then the browser has to build it, just like the house gets built.

Anonymous 0 Comments

If you look at your operating system’s memory usage and see the browser taking so much, part of it is because nothing else has come along to reclaim it.

ELI5 moment: Imagine a kid playing outside in a field of snow. Everywhere he leaves tracks are “his”, because nothing else has come to reshape the snow, even though at any given moment he’s only playing in a few square feet. Only once another force, like a plow comes along, and reclaims the area does it not count as “his” anymore.

Anonymous 0 Comments

I think the best way to explain it is to realize that websites are actually applications, you’re launching an application inside your browser where some of the code of the application is running client side (in your browser) and some of the code and processing is happening remotely (on the server). Once you realize that you’re actually running a program inside the browser memory and cou utilization of the application in respect to the browser makes a lot more sense.

Anonymous 0 Comments

There are two things going on here:

1. Html, JavaScript, and timately even images are a “compressed” way to represent what you end up seeing on screen. They are representative Information that describes a much more complicated thing.

2. In comp-sci one of the major tradeoffs is whether to speed things up y utilizing more memory. Imagine if every time you had to display something on screen you had to do a really complicated math problem – you’d constantly be wasting CPU cycles recalculating something over and over. You quickly would realize that you’re just doing the same math problem over and over and can just save the result to reuse – and so you’ve used more memory to free up CPU. This tradeoff happens everywhere in software especially when performance/speed matter.

Calculate once, sauce to memory, use saved info instead of recalculating constantly.

This is the most common way memory usage grows with software.

Anonymous 0 Comments

hiw else are they suppose to track and surveille everything you are doing?

Anonymous 0 Comments

You’re getting a lot of confidently wrong answers. Yes, the DOM and CSSOM and JS heap and V8 JIT all need space. But not nearly as much as a tab uses. The answer isn’t normal web page stuff; it’s ads.

Ads and analytics scripts require an enormous amount of resources to efficiently steal all your data. For example, a webpage may just be some text and pictures. But here’s what it’s doing in the background:

– An ad provider package is loaded on the page. The ad provider collects a fingerprint of who you are and your interests and sets up a real time auction. It puts out a call for ads and they bid on your click on real time. Potentially dozens of scripts are loaded during this time, each one recording its own analytics to track that it bid for your view and producing a record of who you are and what you clicked. The high bidder earns the right to place an ad on your page. The ad will likely be poorly built and may even be malicious; either way, they don’t care how heavy the ads are. They’ve purchased the right to display it to you.

– An analytics package will be set up to attach handlers to every element on the page. Every click, view, and scroll will be recorded and bundled into a packet of data and streamed near real-time to a data warehouse along with a fingerprint uniquely identifying you.

– Some pages will be using something like Full Story. These pages will literally record every action you take into a replayable video for the website owner to watch back and see how you interacted with their page.

And so on.

Individual web pages are quite lightweight. It’s all the bullshit on top that kills you.