Slashdot Mirror


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?

24 of 766 comments (clear)

  1. Why they are slow? by nospam007 · · Score: 5, Insightful

    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 .....

    1. Re:Why they are slow? by npslider · · Score: 4, Insightful

      It's like watching a 7 minute television program in the space of an hour, divided up every 5 seconds by commercial breaks.. and trying to record the whole thnig sans commercials on an old-school VHS deck.

    2. Re:Why they are slow? by holophrastic · · Score: 5, Insightful

      You're wrong. I've been doing this for three decades now. If you're serving a page to a client, sending them to a third-party to get the library always sucks. Even if they've already got the library disk-cached, it's actually slower to access the disk cache, and check the cache age, and verify that there isn't a newer library version (did you know the browser often goes round-trip just to check?) than it does to simply serve the library in-line.

      Serving the library yourself can still run in parallel, and it often reuses the same primary connection, so it's about as fast as your server can handle.

      Now you're going to mention the browser's memory cache, instead of disk cache. First, nowadays, with each-tab-in-a-separate-sandboxed-process, those memory caches ain't as fast as they once were. But even when they are, you just ain't a'gonna beat in-line scripts.

      Benchmark it yourself. Serve 100KB of javascript in-line, in the middle of your html file. Compare that to a separate src= js file. Mid-stream, in an HTML file of another 100KB, the javascript runs at full download speed, with full text transmission compression. Those 100KB easily compress down to 50KB, more often 25KB, mid-transmission, and at any modern residential bandwidth, you're talking about the tiniest of fractions of a second. No disk access, no file handles, no separate rendering processes, no sandboxes, and, most importantly, no virus scanners, no swapping.

      But it does eat up your server's bandwidth costs.

      If you're huge, amazon style, then you want to off-load cycles and bits anywhere you can. If you're not huge, then the added 10% bandwidth costs mean nothing to you.

    3. Re:Why they are slow? by Anonymous Coward · · Score: 2, Insightful

      > If you're serving a page to a client, sending them to a third-party to get the library always sucks.

      You're clearly retarded. It'd serve from cache.

    4. Re:Why they are slow? by bmo · · Score: 5, Insightful

      >somewhat dysfunctional

      DOOM was 16MB. A whole game in 3D with full on-the-fly animation and sound effects and music. That was amazing for the time when Myst was a game that served up mostly static images.

      A web page mostly serves up text, static images, and sometimes video.

      Yet this needs 16MB to be downloaded to be functional, somehow.

      >somewhat dysfunctional

      Try completely dysfunctional

      Oh, and to the assholes who put in autoplay video that you can't turn off/pause: die. in. a. fire. Your pages actually last 5 seconds in my browser tab, and I'm sure this is the other case with people who are either on mobile, or just simply want to be quiet.

      --
      BMO

    5. Re:Why they are slow? by Impy+the+Impiuos+Imp · · Score: 4, Insightful

      Chatty scripting requiring lots of back and forth. Serving up the ads first before content, trying to make sure the ads are seen. Interacting with ad customization services to eke out an additional fraction of a cent. Scripting that downloads higher quality video in a sidebar ad than the real site. Flash or other crap that runs at CPU max load rather than 99% of it, because the browser makers want that fastest script award and to hell with lockup.

      --
      (-1: Post disagrees with my already-settled worldview) is not a valid mod option.
    6. Re:Why they are slow? by fuzzyfuzzyfungus · · Score: 3, Insightful

      No disagreement here on the quality of craftsmanship that goes into the average webpage. On the other hand; can you imagine how...glorious...the web would be if everyone who didn't have John Carmack on staff still needed to hammer out a bunch of clever tricks in C to get a site up and running?

      It isn't at all elegant; but unless someone discovers a way to churn out good programmers with unprecedented efficiency, I can't say too many mean things about tools that let terrible programmers get merely bad results, since we appear to demand more software than we have talent to supply.

    7. Re:Why they are slow? by Anonymous Coward · · Score: 5, Insightful

      I really don't mean to attack you personally (really, I don't) but your post is a great example of a huge and growing problem in society in general: people who are very very sure of themselves, write well, sound authoritative, but are WRONG.

      Most, if not all, of your argument is based on fast network. Far too many programmers these days just assume huge network bandwidth. They think nothing (MS) of starting a "background" update process which can try to download GIGABYTES of unwanted crap.

      News flash: not everyone has 10GB Internet, Core i7 or better CPU, 16 GB RAM, 1 TB SSD, etc.

      And stop the arrogant attitude of telling everyone they're using dinosaur computers, to "upgrade" everything, etc. By expecting everyone to be on fast Internet, etc., you're shutting out a chunk of your market. I've stopped using many major news sites because a redesign not only looks terrible (if it's readable at all) or takes so long to load it's a waste of my time. The advertisers need to know this, right?

      My poor mom bought a "smart" phone (Android) 18 months ago. Several well-meaning (over-confident, sure they know everything tech) "helped" her by installing many apps. She did not buy a huge data plan, and in 1 month was dozens of times over her data limit- just in the apps constantly 1) phoning home, and 2) updating themselves. The provider was kind enough to forgive her and she gave me the phone.

      And while I'm at it, how about an International law stating that NO website will ever be allowed to download, stream, or otherwise hog network bandwidth without the users 100% knowledge AND permission. Example: I'm trying to read a news article, and an unwanted window starts playing a video without my request nor permission.

      How about ALWAYS, with NO exception, asking the user how much bandwidth they are OK giving up? How about testing network bandwidth BEFORE doing huge downloads? And don't forget latency while you're linking nested .js from around the world.

      About 60-70% of my browsing is done on Old Opera (11.x) because you would be stunned at how much faster most websites are with javascript OFF. I know, all too well, how many websites barely work, or not at all, with javascript turned off. I've studied the code and I see they render in javascript to force you to turn it on because their trackers and ad popups need javascript.

  2. Opera is NOT sane. by snarfies · · Score: 5, Insightful

    >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.

  3. Because Use Cases by bfpierce · · Score: 1, Insightful

    '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.

    1. Re:Because Use Cases by Dixie_Flatline · · Score: 5, Insightful

      Uh, I have 23 tabs open in one window and 39 in another (Vivaldi). I have a dozen open in MS Edge. Lots of them are work related or reference tabs. My Vivaldi tabs are things that I'm reading or things that I always keep open.

      I'm not unusual. When I walk past other people's machines, everyone has dozens upon dozens of tabs open.

      I get that I'm a huge nerd and that my use case is often niche, but browsers are just as much work tools as entertainment tools these days. It IS a useful test case. Hundreds of tabs is maybe pushing it, but it's definitely conceivable.

      Most of the webpages that I have open ARE static content--they're a news story or a review or something that doesn't immediately need updating. It makes it much faster to load. Only a few things like Reddit or Facebook need a lot of refreshing.

    2. Re:Because Use Cases by johannesg · · Score: 5, Insightful

      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.

      Speak for yourself. I normally open a bunch of websites I read, and then just middle-click to open the articles I find interesting in separate tabs. You can quite easily end up with dozens of articles. I wouldn't consider that to be unusual at all.

    3. Re:Because Use Cases by freeze128 · · Score: 1, Insightful

      How about this:

      "Why are browsers so slow to reopen 100 tabs?"

      "Because you're using it wrong, dummy! Stop doing that!"

  4. Why make them faster when most people... by Anonymous Coward · · Score: 4, Insightful

    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.

  5. They're not by kwerle · · Score: 5, Insightful

    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)

  6. If you want to know, measure it. by jcr · · Score: 4, Insightful

    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."
  7. Deep stacks by Bryan+Ischo · · Score: 5, Insightful

    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.

  8. Re:Browsers are fine by Allicorn · · Score: 4, Insightful

    "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!!!
  9. Re:Browsers are NOT slow by Calydor · · Score: 5, Insightful

    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=-
  10. IE 6 only uses 64 megs by Billly+Gates · · Score: 3, Insightful

    Just saying ...

  11. Re:Browsers are fine by npslider · · Score: 4, Insightful

    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...

  12. This post makes me feel old by zifn4b · · Score: 3, Insightful

    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
  13. Re:Browsers are fine by Whorhay · · Score: 3, Insightful

    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.

  14. Too many 3rd party scripts being called. by Kernel+Kurtz · · Score: 4, Insightful

    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.........