Slashdot Asks: Why Are Browsers So Slow? (ilyabirman.net)
Designer Ilya Birman writes: I understand why rendering a complicated layout may be slow. Or why executing a complicated script may be slow. Actually, browsers are rather fast doing these things. If you studied programming and have a rough idea about how many computations are made to render a page, it is surprising the browsers can do it all that fast. But I am not talking about rendering and scripts. I am talking about everything else. Safari may take a second or two just to open a new blank tab on a 2014 iMac. And with ten or fifteen open tabs it eventually becomes sluggish as hell. Chrome is better, but not much so. What are they doing? The tabs are already open. Everything has been rendered. Why does it take more than, say, a thousandth of a second to switch between tabs or create a new one? Opening a 20-megapixel photo from disk doesn't take any noticeable amount of time, it renders instantaneously. Browsers store their stuff in memory. Why can't they just show the pixels immediately when I ask for them? [...] Unfortunately, modern browsers are so stupid that they reload all the tabs when you restart them. Which takes ages if you have a hundred of tabs. Opera was sane: it did not reload a tab unless you asked for it. It just reopened everything from cache. Which took a couple of seconds. Modern browsers boast their rendering and script execution performance, but that's not what matters to me as a user. I just don't understand why programmers spend any time optimising for that while the Chrome is laughably slow even by ten-years-old standards.Do you agree with Birman? If yes, why do you think browsers are generally slow today?
Because we need a canvas-blocker add-on and a flash-blocker add-on and a cookie warning remover add-on and add-ons to remove all the ads on the page and we need add-ons to remove the dozens of trackers to protect our privacy and also add-ons that remove all the social buttons (twitter, FB, etc) which share our behavior even if we are not a member and add-ons that remove all the javascripts that load popups, do unwanted refreshs and Greasemonkey to make some pages readable and remove the ads that are inside the articles and we need an add-on to circumvent the anti-adblockers and .....
>Opera was sane: it did not reload a tab unless you asked for it. It just reopened everything from cache
No. That is NOT sane, normal, or desired.
Webpages are live. If I want to look at a chached version, I'll save the webpage locally. If I'm pointing a browser at an address, I expect a current webpage. If it takes all of three seconds to give me that, I think that's okay.
'And with ten or fifteen open tabs it eventually becomes sluggish as hell.'
I don't think that's the standard use case for testing, nor should it be. What the hell are you doing with that many tabs open.
"Unfortunately, modern browsers are so stupid that they reload all the tabs when you restart them. Which takes ages if you have a hundred of tabs."
Again, good lord. Hundreds of tabs? What are you even doing.
As to refresh, I think that's become a user expectation that you see the most recent information when you pull up a tab. Having to manually do it isn't something a standard user is going to do.
Maybe what you're looking for is to have 'power user' settings in the browser, so you can keep your hundred tabs open.
obviously don't care about painfully sluggish programs. Just look at the number of people that find Windows acceptable despite being horrifically slow. If you can get away with inefficient and poor code, why spend the extra money to hire decent programmers to make something not slow. There's no reason why Windows should take tens of minutes after boot before it becomes usable or why clicking on a Windows should usually take more than a full second, but because people keep giving Microsoft piles of cash for giving us crap, they have no reason to fix it.
Possibilities:
* You have too many slow addons enabled
* You are out of RAM
* The page is slow (big/complex)
* Your network connection is slow/saturated
* Their network connection is slow/saturated
* You are out of CPU (unlikely)
Check out the WebKit project, build it yourself, and run it under Xcode's profiling tools.
-jcr
The only title of honor that a tyrant can grant is "Enemy of the State."
I don't know the specific code in question, but I have seen enough code to have a theory.
Long-lived software projects that implement programs with complex features (and web browsers have an astounding array of features), especially those that interact directly with users, who put programs into a position of continually having to respond to extremely complex sets of inputs (just think of how many valid inputs there are to a web browser at any one moment), tend towards a style of implementation that can best be described as "layers upon layers upon layers of framework".
One aspect of programming that many engineers are, in my experience, not very good at, is deciding when to simplify frameworks versus making them more complex. I think it comes from a fear that many people have of painting themselves into a corner -- we've all seen code so inflexible that it makes extending it at a later time difficult, and I think that many people respond by going too far in the opposite direction - to avoid painting themselves into a corner, they put 100 doors in every room so that there is always a way out.
The end result is that every aspect of the complex program is designed to be extensible well beyond anything that will ever likely occur in practice. And the interactions between these complex layers of framework become so complex themselves that new layers have to be invented just to try to simplify things and allow any hope of rationally moving forward.
So what you end up with is incredibly deep stacks of function calls for almost any action, as various extensibility layers are passed through, along with the layers that consolidate previously implemented extensibility layers into simplified layers that more directly match the actual requirements of the program.
I have occasionally seen stack traces from programs like Firefox, and I expect Chrome is no different, and the depth of the stack at the point of a crash is always somewhat breathtaking. You may end up going 30 - 40 layers deep before you actually get to a piece of code that has a tangible effect on the state of the program.
Now imagine that a particular user input requires running through a function that has to call out to several parts of another framework layer, and you're going to be paying the deep stack penalty multiple times.
What you end up with is a large code base that does everything necessary, but in a way that is embellished to a nearly pathological degree, where every action takes 10 - 20 times longer than it would had that action been encoded much more directly and with far fewer framework layers.
The advantage of such a large code base is that it has enough flexibility to rarely, if ever, require a complete redesign as new feature requirements come up.
The disadvantage is that it will never operate as efficiently as a more directly coded program, and you get user interfaces that require executing literally billions of machine instructions just to effect fairly simple changes to its internal state machine.
That's your web browser.
"Wrong" is harsh, I agree, but I do wonder about folks that have so many tabs open. Isn't that what bookmarks are for? You're obviously not flipping between 100+ pages in the course of a single /task/. How often do you look at the 99th least frequent of those tabs? Is that frequency worth the resource load of having the page loaded vs loading the page on demand? Is it genuinely faster to find a tiny little tab in a - presumably - rather squashed cluster of 100+ than it is to find a bookmark on a menu and have it load or am I envisioning what 100+ tabs looks like completely, heh, well, "wrong", because I don't do it myself?
Again, not saying "wrong" at all - just saying I'm one of those users that closes every tab after looking at the page. My average tab count over the course of a day's work is probably three - so having 100+ tabs just seems unfamiliar to me.
Also, you say it recently became difficult. That's in a particular browser? Any idea what changed?
OMG!!! Ponies!!!
I am trying to figure out what part of what you wrote (which is all true, mind you) explains why opening a new tab in Chrome or Firefox has to take as long as it does.
-=This sig has nothing to do with my comment. Move along now=-
Just saying ...
http://saveie6.com/
I'd say it's a very individual thing.
Some people think in a straight line, others more like a tree branch. The 'straight liners' only need to keep a few tabs open at a time to follow the single mental thread they are following. Those who quickly branch out and multitask will inevitably have numerous tabs open.
It's like the case of the spouse who is talking on the phone, feeding the baby, cooking dinner, and folding laundry compared to the other spouse, having a hard time focusing on the football game while reaching for another beer...
Ok, I am very astonished by this question "Why are browsers so slow?" which since you're most likely a millenial you might as well re-phrase the question as "Why are browsers slow AF?"
No offense but you obviously have no idea what a slow browser really is. Try Netscape 6 or IE6 and let me know if you think Chrome is still slow. First of all, are you sure you can attribute all the slowness to the browser itself? Did you crack open the modern browser developer tools that we all have now (hint: Firebug and Chrome developer tools didn't used to exist until a few years ago) and look at the network tab or equivalent to make sure that the web server/REST service/whatever isn't taking a long time to serve back data? Better yet try profiling your own javascript code with console.log, console.time/console.timeEnd. Since you can use an identifier, you can even do it asynchronously, how fancy is that? I seriously doubt you've done any of these exercises because most modern browsers take javascript, compile it into native code and cache which is about the fastest you're going to get javascript to run. Microsoft completely rewrote it's rendering engine multiple times the latest of which is Edge. Firefox, Chrome and Safari have all had similar efforts. I've been a web developer for a number of years and I can tell you, the stuff we have now is lightning fast.
You try serving up a web page to Netscape Navigator using a cgi-bin perl script from an old version of Apache and let us know if you think modern tech is still slow.
It just appalls me. No matter how much better we make technology there is always a generation that comes along and tells us all of our effort are crap because they think everything needs to be bigger, better, faster. If you want to complain, you get engaged and make it what you think it ought to be. Until then you have no room to complain if you're just going to comment from the peanut gallery. Gah.
We'll make great pets
I'm pretty sure it's more about mental focus and self discipline. Our minds don't actually let us multitask, at best we switch tasks very rapidly. But I suppose that's being pedantic.
My wife usually has dozens of tabs open when I look at her computer. She opens articles and such that she wants to read later in a new tab and moves on. I do the same thing when perusing my news feed. The difference is that I usually go and read those articles within a couple hours and close them out. She will stay occupied with other things and end up with tabs that she opened weeks ago still hanging there. When I have an article that I just don't have time for I'll bookmark it and close the tab. Youtube actually has a feature that I love and use the hell out of, and that is the 'watch later' button.
Neither of us focuses particularly well. I just exercise some self discipline for up to 30 seconds per evening and don't end up with a computer bogged down by dozens of extra browser processes.
Even with no-script (or especially with it as may be the case), I try to load a page. It partially works, but needs some scripts to work properly. I tell no-script to allow all this page, but then when it reloads it wants even more scripts from more places. Tell no-script OK again, and then when it reloads, it still wants more, or some of them change.
Sometimes takes 3 or 4 tries allowing and reloading just to get pages to render by the time I've approved the 50 other sites they want to load content from.
Generally speaking, I try to avoid websites that go overboard this way, but it is sadly getting to be way too common. Sometimes the no-script list is so long I have to scroll through it.........