Is Safari faster?
From the extremely biased propaganda tech news brief from apple in the previous tech news post, I knew instinctively that the genius browser expert from howtocreate would have all ready have done the proper benchmarks, gave his comments, and trounced that in the end Opera is still the fastest browser. Here is the article below.
Is Safari faster?
At the release of Safari 3 beta for Windows, there were several claims about Safari’s page load performance. It was giving results that showed it was clearly faster than other browsers. Since I generally like to check things for myself instead of trusting what companies say, I gave the new Safari a whirl. Sure enough it was very fast. Its CSS was quick, its page loading was quick, its JavaScript was quick. Perhaps quick, but certainly not as fast as they seemed to claim it was.
I have a variety of machines that I tested it on, and all showed the same thing; it was fast, but not really faster than the competition (Opera, for example, but other browsers were also faster in some cases). But when tests used JavaScript to check the page loading speed, Safari produced numbers far smaller than other browsers, even though the actual page load was not faster when tested with a stopwatch. Simple CSS float tests would produce times of less than 100ms, while the actual page load (from disk, so no network lag is involved) could take as much as 5 seconds.
(Note: before any of you ask, I will not be adding results to the browser speed tests article – it is retired.)
When does onload fire?
The tests all relied on the onload event. That has always seemed trustworthy until now. However, Safari does not fire onload at the same time as other browsers. With most browsers, they will wait until the page is loaded, all images and stylesheets and scripts have run, and the page has been displayed before they fire onload. Safari does not.
In Safari, it seems onload fires before the page has been displayed, before layout has been calculated, before any costly reflows have taken place. It fires before images have completed loading (this can also happen in rare cases in Opera, but Safari seems to do it everywhere), meaning that a substantial part of the load time is not included. So basically, onload is not trustworthy in Safari for checking page loading times.
It is possible to force Safari to layout the page before checking for the time. To do this, check for the offset values of any element, such as the offsetWidth of the body:
window.onload = function () {
var ignoreMe = document.body.offsetWidth;
var endTime = new Date();
};
Note, however, that this still does not include actually displaying the page, only calculating what will be displayed, so it is not perfect, but it does make it slightly closer to the behaviour of other browsers.
Does progressive rendering play a part?
Many browsers, Opera and Firefox included, use progressive rendering during initial load. As soon as they start to receive page data, they start to parse it, generate the DOM, and display it. Scripts run as soon as they are received, while loading continues in the background. This means that if you start timing in an inline script at the start of the page, Opera and Firefox will start the timer before the page has completed loading, and therefore rest of the page load is taken into account by the timer.
A server that intentionally fed the test page slowly to the browser caused Opera and Firefox to show the expected long difference between the initial time, and the onload time. In Safari, onload fired about when it was expected, just before the final displaying of the page. But the time difference between the initial time and the onload time was very small; close to 0ms. So it would seem that Safari waits for the page to load before starting the parsing and script interpretation, meaning that it only showed the time to parse the DOM, not the time to load or display the page, while the other browsers would show the complete time.
Of course, progressive rendering itself does take a few more reflows, so it can take more time than a single render, but it also means you can begin to read the page earlier, so which one feels faster to a user may differ. However, I am only referring to completed load times here.
Can pages really load that fast?
How quickly can a browser load a page over a network? Can it establish a network connection, load a page, parse the HTML, initialise the script engine, and create a date object, all within 0ms? If it can, what about if the network lags a little; what happens if the network introduces several milliseconds worth of delays into the page load – can it still load within 0ms? Safari seems to think so.
To avoid the problems of progressive rendering vs. offscreen buffering, it is fairly easy to start a timer in one page, and then load the test page into an iframe. The test page can then check the difference between the completed page load time, and the time stored by the parent page. It would be nice if it were that simple. However, this shows a bug in Safari.
Safari does not update the date objects correctly. It appears to pause the date object while iframe src changing, page loading, and parsing is taking place, so the next request for a date object produces one with the same time as the one in the parent page. Even when forcing it not to cache the page, this still happens (and yes, I tested many times since I did not believe it myself). The page load itself could be seen to take about half of a second when timed with a stopwatch. Clearly, Safari has a bug with date objects here.
Was Safari cheating on the test?
Well, its results are almost certainly wrong, and it will appear a lot faster than it really is, if JavaScript is used to time it. The results are completely unreliable. As for whether or not it was intentional, I doubt it. The paused date object is almost certainly a bug that they need to fix. The offscreen buffering is intentional as it can improve load times on small pages or exceptionally long pages. It makes script timers unreliable, but there is nothing that says that a browser has to use progressive rendering.
As for onload firing early, that feels like a bug, but the spec does not say what counts as “loaded” – it does not say that the page has to be displayed (however, all images should have loaded, so that part is definitely a bug). Safari is not wrong to fire it before layout, but it is inconsistent with the other browsers. In some cases, this is useful, as a developer may want to manipulate the page before it displays, at the end of parsing, and with Safari’s behaviour, it can do that without needing any extra reflows. Safari then adds in the offset measuring behaviour to allow for authors whose scripts expected the other behaviour. It works for real Web pages, but it is not good for performance timing. Firefox and Opera have a better approach, which is to use onload normally, and to use the DOMContentLoaded event to say what parsing is complete.
Are there other ways to test?
Since the browser itself has proven to be so unreliable in giving page loading times, it is not possible to use JavaScript alone to test page load/display times. Something more trustworthy needs to be used. The obvious solution is the trusty old stopwatch. It introduces reaction time errors, but it’s not too bad for most tests as long as the test takes sufficiently long on its own.
To automate the tests, only a server is reliable enough. Use an outer page with an iframe initially displaying about:blank. Then do an XMLHttpRequest to the server to retrieve the time on the server (this is best done with a server on localhost to avoid network lag). The server can return the timestamp as a number (such as with PHP’s microtime(true) function), and should return it with a mimetype of text/plain to make sure the browser does not waste time trying to parse it. Make sure the response cannot be cached. Change the src attribute of the iframe to be the test page (which should also not be cached).
When onload fires, check if there were any images, and if so, make sure they are all complete by checking their complete property. If not, wait for onload to fire for each of them before continuing. Once loading is complete, check the offsetWidth of the body, then make a second request to get the timestamp from the server. Check the difference to get the time. Note that this still does not include time to display the page, and I do not know any useful way to get around that limitation. It also includes the time used to make the XMLHttpRquests, which will alter the results slightly, though certainly not as much as Safari’s own failure to use onload and date objects correctly.
So is Safari actually slow?
No. Safari is not slow. It is still a very fast browser, but it is certainly not as fast as it has been claimed to be. This is not an excuse for other browsers, and it is not a complaint. It is simply a warning; do not rely on performance benchmarks in Safari. They are wrong if they ever use JavaScript to detect page load times, which most of them do. Until the Webkit project can fix these problems, Safari benchmarks are not accurate or reliable.
This may not cause a problem for you (and I am not interested in receiving any emails saying that problems do not exist or are not really problems for you – they do exist and they are problems for others), but they are a problem for benchmarks. If you know a good workaround for them that can produce reliable benchmarks in Safari, please feel free to share.
source: howtocreate.co.uk

Comments(37)
So let me get this straight, you bitch because apple posted ‘biased’ numbers. So you go, and find someone that’s on opera’s payroll to prove that opera is faster?
http://www.howtocreate.co.uk/operaStuff/myJob.html
I’m not saying he’s wrong, but next time you try to bitch about biased journalism, find someone who really is independent.
this is the first time i’ve read about Opera in a Safari-for-windows related article in the last few days and i’m glad. everyone is always only talking about ff and ie. even though ie is only used by people who don’t care…
opera rulz. yes i’m biased.
Re: Mr. X
“I got this job after writing my browser speed tests article, and it was not biased.”
Yeah that settles it, he’s not biased because he says so!
Opera is fast and lean and I would’ve used it more if it had one tenth of the extensions and add-ons Firefox.
And, before you reply, whatever tricks and tweaks you have for making it perform like FF in that area it’s just not the same.
So now we’re to believe he’s not biased because he says so? Is that the definition of proof on the internet?
As for “I got this job *after* writing my browser speed tests article, and *it* was not biased”, He STARTED working for Opera in 05, TWO YEARS AGO. So the ‘browser speed tests’ he’s talking about are the ones that are at least 2 years old.
This article was written well after he’s been on Opera’s payroll. And if this were a Microsoft employee you’d be all over him being biased.
You’re missing my point … you complained that apple said apple’s browser was faster… So you show everyone an article where an Opera Employee said that Opera’s faster.
That’s the facts.
My IE7 is the fastest of all…you know why?? My NOS sticker on the side of my computer…page loads are 10x faster
I have a Turbo button and Math Co Processor so beat you
I think what needs focused on here is his analysis of how Apple could have arrived at such skewed results (for surely they are). You’ll have to do better than “he works for Opera” to disprove the conclusions he’s arrived at with regards to Safari’s performance (which he doesn’t say is a dog, just that it obviously isn’t as fast as Apple would like us to believe) irrepsective of what browser you compare it to.
I painted my machine red, cuz every knows da red wunz go faster.
i
Haha apple can suck me.. Use Linux or Microsoft.
And for the browser use Opera, nice interface and is indeed very fast.
Anything by Apple is shit… If your not going to use Windows at least use Linux or Unix.
Common don’t we all know Apple is just for mindless teens that follow everything the media says?
opera rules!period.
^ same here
Its nice but I like FF better. Gecko is nice too.
All I have to say is: Thank you.
1st :-
ReLaX Guys , Faster browser isn’t important than the security one.
u’ll find out when u using alot of browsers for a long time.
2nd :-
Try to be a nice and a gentelman when u choose Ur words B4 u write it here cuz that’s what the Real men do.
——
10x Mr.X , That’s means check B4 u believe what they wrote.
I totally agree with the first comment by Patrick.
I don’t know, I have all of the major browsers installed, and here’s my take: Opera is the fastest all around but I can’t get used to it, Safari is noticeably faster on many pages but much slower on others (such as Gmail), Internet Explorer sucks, and Firefox is a memory hog. My personal choice is still Firefox because of its extensions and how helpful they are. It isn’t the fastest, but it is fast and it works for me. I mean, Adblock Plus for one.
Safari still has a good way to go to become a great Windows app, but I believe it’ll get there.
I agree what Mr0 wrote it may be faster but we cant judge it right now until we see if there are any exploits in the program. this is going to rage on forever. I would rather have a regular browser that protects my credit card info. than a fast one anyday.
firefox is fast enough + the all in one gesture exts makes it the fastest of all.
gogo FireFox!
Ofcoarse this gets into a best browser debate.
I like Opera best, because I don’t use firefox extensions and I like speed dail alot.
Such comparisons are plain wrong.
A faster rendering engine does not unnecessarily make a browser faster.
@WingAttackGroupExIl
…?
Gecko IS the engine used by FireFox.
Oops…
I odiously meant necessarily and not “un”necessarily above
@all Apple fan boys/FF freaks/Opera abusers & IE inbreds:
There is only one true webbrowser, and that’s Lynx..
@patrick and similar:
Just because he’s on the pay roll doesn’t mean it’s biased. companies can release scientific studies and do you think these are biased? half the research you hear in the news about some new drug being developed or some pyschology study is done by a research company dude.. pretty much everything in the media can be thought about as biased especially software reviews eg. cnet.com that gives norton antivirus like 5 stars… look at his claims, the method and see whether you think the approach is scientific and would produce unbiased results. agree with those not just the fact that he’s on the payroll. What about the safari testers were they not on the payroll of some kind? were they not apple fanboys? He clearly presented the facts as he found them and CLEARLY adds he is not complaining and he is not claiming foul play and that those bugs werent intentional. how is that biased? I did not get the impression he is pimping opera from the article but merely presenting his findings.
ps. you sound like an apple fan boy like 100s of computer science ellitist wannabees i know at uni sporting around their macbook pros. Sounds like you just believed the safari tests without questioning it like a fanboy. For the record I have got a comp sci degree and mech eng. and have worked with macs, linux and windows throughout uni and still prefer windows only because i grew up on it and haven’t spent the time learning linux properly. Apple OS does have some very good ideas especially expose` and all the other jazz but at the end of the day after all the fanboys have argued themselves to death it just came down to which OS was i more comfortable/most productive to use and that’s still windows because because mac doesn’t have FEM and other engineering software i’m not even sure if it has autocad support. And plus you can’t compare a mac if you are using it to play games. It all comes down to clever marketing and ad campaigns and the uneducated consumer (eg. intel advertising on Mhz when nowadays that’s less important).
Hmmm… I just downloaded the new safari 3.0.1… which I am using at this moment… and loaded some pages I commonly go to…. and yes… it most definitely loads them faster….. I’m worried about the security and bug issues tho… kinda worried about starting to use this as my main browser… hmmm…
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
DONT DOWNLOAD this Crap.. Safari is -LAME-
iTS ABSOLUTELY STUPID SOFTWARE,
some pages LOCKing + FREEZiNG !
fastest??? blah..LiE!
FiREFOX better + Number.1
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
personally i just don´t give a shit if a page loads within 100ms or 250ms since you fcking won´t notice anyway
what really counts is the usability and how fast i can work with the browser. the faster i can open boomarks, use extensions, switch tabs etc etc the faster i surf teh interwebs.
no offense to any of the posters here, I’m sticking with Firefox (2.0.0.4) I’ve NoScript & AdblockPlus with Mcafee Siteadvisor installed.
I also have IE v7.0 & Opera installed.
I’m happy to say IE & Opera can’t beat my install of firefox with the add-ons
I’ll agree, if there were only more plugins available to the other browsers such as NoScript or AdblockPlus they’d be better
And as usual everybody goes on about Safari 3.01 BETA and compare it to browsers that has been around in production versions, released versions since many years back on windows.
This version you all have been testing is a BETA. The results they get at apple are ofcoursed biased by them by selecting sites and testing the browser on a system they know for sure it will work great on.
I think it will be at least untill version 4.x (or even version 5.x) of Safari before it is even close to stable on windows since the same situation has been there with iTunes that was very unstable in the early versions but nowdays i find it to be just as stable on windows and os x (almost)
Opera doesn’t need NoScript, AdBlock or SiteAdvisor plugins. Similar functionalities are already built-in to the browser, and Opera is still leaner and faster than FF.
I think browser page load speed depends on:
- browser config
- enviroment (NET speed, RAM, CPU, HDD, VGA)
U can set the browser config to use your enviroment wisely…
(RAM usage, Cache, 0
Firefox: about:config (type in as an URL)
Fasterfox add-on
Other browsers: search…
And an ad-blocking sw/extension will also improve speed
(no ad picture/script loading/running)
If u have an x64 architecture and OS then u should also download a browser using x64.
Firefox:
3.*: http://www.mozilla-x86-64.com/download.html
2.0.0.4: http://www.vector64.com/WindowsBuilds.html
I think most of the browsers will do the same properly configged.
Amazing. Apple gets caught in an obvious, if, in typical Apple style, low-rent cheat, and people defend them? Yeah, must be a bug when their POS browser is set up to tell you it’s faster than all others when it isn’t, couldn’t possibly be a poor attempt at deception.
Yeah, and no display on your MP3 player is actually a feature, right?
Jobs certainly got his money’s worth when he sold he soul to the devil.
@rogue
The problem with Lynx is it’s slow development.
Many Lynx folks already joined Links(2).
I still prefer w3m for text browsing though.
Apple tactics are fuckin gay. The least they could do is make it kick ass like they “claim” all their products do. Apple – catering to the dumbass wanna-be cool people all over the world.