The Mac "Fast Path": Safari 4 vs. Chrome 5




I did a quick benchmark of scroll speed in Safari 4 vs. the new Chrome 5.

My benchmark is, "Drag the scrollbar up and down furiously in Google News while running Shark."

And Chrome feels a lot faster than it did before. A lot.

But, Chrome still pegs the CPU during my test. Amazingly, Safari doesn't use all of a core. Scrolling in Safari is a relaxed day for the CPU.

The shipping version of Firefox has a profile more like Safari's--apparently it's using the system functions to scroll bits. However, a new experimental Firefox that uses layers (aka hardware textures) experiences a bottleneck quite like Chrome's.

Maybe in this case, people are slowly reading back from hardware textures instead of blending to surfaces in memory. I don't really know the details, but my experience as a coder is that there are a lot of slow ways to do things on a Mac.

It occurs to me that one of the things that Windows has done well is to expose layers of abstraction and optimize a ton of permutations, so when you want to go "one level deeper" you can, and you can make it as good as the function built into the OS. If you want to write your own DirectShow filter to be in the native pipeline to the hardware, you can. If you use a weird mode in Direct3D, it is often still fast. You can mostly understand the profile and what's holding you up.

Apple provides tons of options for drawing bitmaps: blend modes, color calibration, ways of drawing bits to the screen. But not many of them are fast. If you turn on the wrong color-management bits, your app can become 50x slower, and this is no good.

In the early days of graphics workstations, vendors would optimize one or two "fast path" ways to draw to the screen,. But in the world of awesome NVIDIA drivers, now a lot more of those options are fast, because we've had the benefit of 15 years to work out all the details.

MacOS X seems to have some "fast paths" and a lot of slow ones that developers are getting tripped up on. But it is one thing to make a few abstractions that do a few things well, and another thing to make a platform that does anything you want to do well.

Today, it is difficult for Flash to get the best video decoding (my 10.1 "Gala" build of Flash chews CPU like a pig while Quicktime is nearly idle), and it has taken a year for a team of really smart people at Google to get a browser to scroll almost as fast as the one Apple provides. Picasa draws its UI 10x faster on Windows. The trend is not so good, unless you use Apple's widgets all the way up and down.

Steve Jobs should very simply stop criticizing other companies' performance until he makes his platform fast by default. Whether it takes sample code or performance tuning help or improvements to the OS, Apple's own apps shouldn't be running 10x faster than other apps that do the same things.

If the other companies really were actually lazy or incompetent, you'd understand, but honestly, Netscape Navigator back in 1995 scrolled fast, on Windows 95, on XWindows, on System 7. It's not a new, hard problem for an OS to do something like this well.

It's probably time for some new benchmarks, because when some of the bottlenecks are below the level of the applications, it's hard for people to understand who's at fault.

7 comments:

  1. There are blazingly faster GPUs in nearly every computer, yet 2D, let-alone 3D, graphics stills appears to be make work. I don't get it.

    ReplyDelete
  2. So how is it that Picasa scrolls so fast?

    ReplyDelete
  3. Why can't Apple figure out how to scroll a page of user agreement text smoothly in iTunes?

    ReplyDelete
  4. I think it's nuts that perfectly smooth scrolling isn't something that's been figured out by now. Computers keep getting faster but scrolling is still totally random. Firefox is faster than Chrome is slower than Safari. Picasa is faster than Aperture despite being the most un-apple looking app in existence. And of course the iPad is faster than everything. Wtf.

    ReplyDelete
  5. We haven't figured out how to mix hardware and software. Once that's done it's all easy. Until then, you have to be smart or careful to make it work.

    ReplyDelete
  6. any info on safari5? I really want to make the switch from FF.

    ReplyDelete