Warning: Extreme nerd content.
View source on just about any Google page and you’ll see most of the code jammed together on a single line. With the kind of volume they do, every byte saved adds up to real money, so removing line feeds saves dough. But if they’re being that careful about conserving bandwidth, how does Google Video figure into the equation? Thought it might be fun to do some cocktail napkin math.
If I run a Google search and save the source code to a file, that file is 24032 bytes. If I open it in BB-Edit and run Format | Plain (which adds line breaks at logical places but adds no indentation), the file grows to 26868 bytes*. So Google is saving an impressive 2836 bytes (2.8k) per SERP by removing line feeds.
Now, assume a video stream that runs at around 2MBs/minute and lasts three minutes. At 1048576 bytes per MB, that’s 6,291,456 bytes per video stream. Which gives us a ratio of:
6,291,456 / 26868 = 2218.4 / 1
So the precious bytes Google saves by removing line feeds on 2,218 SERPs is nullified by serving a single three-minute video. Of course, they dish up a hell of a lot more SERPs than videos, but it does raise the question: Is bandwidth precious to Google or not? I can picture the looks on the faces of all the engineers who had spent a decade living under the “Optimize the hell out of it” mantra the day they learned the company would be serving up unlimited gobs of video to the public for free.
Update: Sean observes that some of the videos he’s downloaded from Google average 6 MBs/minute, which would pretty much exactly double my estimate. We would need to download a bunch of videos from Google to get an accurate average, but if they’re averaging 6MBs/min, it makes me think that very little optimization is going on in Goog’s video dept. I train students to compress video at around 3 MBs/minute (320×240, 15fps, MPEG4). Since I was assuming that Google also has a strong interest in video optimization, I originally assumed that their streams would be of a similar size.
* Incidentally, if I run Format | Gentle Hierarchical at this point (which adds common indentation for nested elements), the file swells to 43356 bytes. And if I run Format | Hierarchical (which indents aggressively), the file swells to 64102 bytes — almost 3x its original size. Yow!
Technorati Tags: bandwidth, google, optimization