Comment

Comment by reissbaker

You're right: replacing HTML with protocol buffers wouldn't do much to make the web smoother. HTML is immediately parsed into a tree stored in memory, and the initial parsing overhead is negligible compared to asset load times (on this site, for example, Chrome reports parsing took ~0.4ms, whereas loading the tiny upvote arrow took a whopping 45ms). Once loaded, pages wouldn't be any more smooth than they are today if they used a binary encoding: regardless of whether you ship trees as binaries or text, after the initial parse the in-memory data structures used by the browser will be essentially the same. GZIP is fairly efficient at encoding HTML tags, and protocol buffers (and any other binary format) would have to encode all of the non-tag text on the page anyway. The gains from binary formats there are minimal.

Controlling browser prefetching and load ordering would do much more than rewriting to use a binary format, as would alternative layout options, as would better image formats, as would more performant VMs (e.g. better asm.js support), as would... A near-endless number of things. Text vs. binary for the initial document tree doesn't make an appreciable difference.

parent reissbaker 12 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton