Why Does Safari Initially Compress Cached Pages?

Discussion in 'Mac OS X Lion (10.7)' started by Dunbar, Sep 26, 2011.

  1. Dunbar macrumors 6502

    Joined:
    Jun 25, 2010
    Location:
    Los Angeles, CA
    #1
    Anyone notice when you L/R two finger swipe between pages in Safari it initially loads a compressed version of the cached page? Just wondering why it does that and also why it reloads the page every time? Just go my first Mac so OSX is totally new to me. I can post a screenshot if need be, just don't know if you would be able to see it.
     
  2. WAM2 macrumors 6502a

    WAM2

    Joined:
    Jan 6, 2011
    Location:
    United States
    #2
    Saves Disk Space.
     
  3. Dunbar thread starter macrumors 6502

    Joined:
    Jun 25, 2010
    Location:
    Los Angeles, CA
    #3
    Can it be turned off? IMO it waters down the advantage of swipe.
     
  4. WAM2 macrumors 6502a

    WAM2

    Joined:
    Jan 6, 2011
    Location:
    United States
    #4
    I Don't think so.. Since Safari is built into OSX its very unlikely something like that could be disabled, ALTHOUGH, you can try to go into The Safari Preferences and then advanced then put the Database Storage to 500mb.. If that doesn't do anything It is unlikely to be able to be changed.
     
  5. coteyr macrumors newbie

    Joined:
    Sep 27, 2011
    #5
    More technical answer.

    Ok so, when your viewing a web page in a tab, your interacting with that page. When you switch to a new tab your no longer interacting with that page. This has some serious side effects with Cross site scripting protections and with javascript. A lot of javascript calls (in fact almost all of them) require the user to actually be looking at the view port (think of it like the tab) in order to run. This is a security thing, so that you don't leave a tab open while it does something like read every file on your hard drive (not that it can directly do that anyway), or more recently run that little SSL cracking javascript while your watching YouTube on another tab.

    The side effect of this is that the page is "stale" when you go to view it again. Think of it like your bank. Your on your bank page, then you tab over and watch 30 mins of YouTube, then go back to your bank, and you will be logged out.

    Caching (and compressing) the page in an inactive tab means you have something to go back to other then just a loading bar. 99% of the time this is fine because it's just going to reload a "read only" page. 1% of the time though the refresh causes some kind of server side reaction (like the bank site logging you out) and you get a noticeable different set of content (log in page instead of bank statement).

    So for fast review, if a page was held active, just on another tab, the page would be in an invalid state because the javascript on the page could not run, and because certain CSR protections would be incorrect. If the page was not cached you would get a nice white blank page, and no content while the request was sent and received to the server. And if is was not compressed, you would end up with safari chewing up Massive amount of ram (like 4-5 gigs) because of how tabs are really just documents, etc. More then likely the ram issue would present as lots of disk trashing in other apps because safari would have all the memory used for disk buffers assigned to it's self.
     
  6. Dunbar thread starter macrumors 6502

    Joined:
    Jun 25, 2010
    Location:
    Los Angeles, CA
    #6
    coteyr, I appreciate you taking the time to respond. I notice Chrome doesn't handle cached pages this way. It loads the cached page from memory uncompressed and also doesn't reload the page every you go forward/back. Granted, it also doesn't have the snazzy animations either but, AFAIK, Chrome is just as good at conserving memory as Safari. I would use Chrome as my default browser if the gestures were as fluid as Safari.
     
  7. Quad5Ny macrumors 6502a

    Quad5Ny

    Joined:
    Sep 13, 2009
    Location:
    New York, USA
    #7
    Switching from "Two finger" to "Three finger" swipe disables this feature.

    It also saves memory, because Safari doesn't save snapshots of each page.
     
  8. Daveoc64 macrumors 601

    Joined:
    Jan 16, 2008
    Location:
    Bristol, UK
    #8
    IMO Safari is being designed with the constrained resources of an iPad/iPhone in mind and as such, they are making it work just like the browser on those devices (i.e. other tabs are not refreshed or purged from memory entirely).

    Even if it's not about following the same logic on the Mac OS X version, they're doing it to condition people into thinking that this is how all browsers work.

    No other browser works this way.
     

Share This Page