|
Looking at what it takes to actually implement the "belly of the beast" from scratch, I don't blame them. (Also, after seeing the below 350-line function that's part of a 3113-line file, I now know that whenever I'm yelling at CSS layout behaving weirdly, there's someone with a much, much more frustrating job.) https://github.com/servo/servo/blob/master/components/layout... EDIT: for anyone who doesn't know, https://servo.org/ is Mozilla's ambitious project to rewrite their browser from scratch with concurrency thought in from the beginning, supported by Rust's unique approach to safe concurrency. Parts of it have already made it into Firefox: https://bholley.net/blog/2017/stylo.html |
Browser authors are on the receiving end of over 20 years of standards all written by people who were not, personally, the ones implementing them, plus a healthy dollop of "code that worked in this one browser once and become a de facto standard", for which the way tables format themselves in all their myriad ways comes to mind, based around whatever was convenient in already-crufty codebases now long dead.
And then all these nightmares get together and interact. And the end users expect this to be fast. And web developers expect to be able to reach into the middle of this epically complicated data structure and tweak a style and have what may literally be the entire page rerender, and they expect that to be fast and easy. And using a language that was never written to be fast. (If anything, Javascript was written to be implemented quickly, if you read the story about where it came from. There was no time to be worrying about how well it could be JIT'ed 10ish years later.)
I don't spend a lot of time wondering why my browser is so slow; I often find myself wondering how it manages to be so fast. The spec for a browser is insane. I definitely believe that a future of browsers will be a combination of web assembly and a much more raw rendering layer that will offer access to font rendering and the OpenGL primitives, and a non-trivial number of the biggest websites will eventually implement their own renderers. I say "a" future because the current web rendering system will be around to the end of my prognostication powers. But I suspect this bypassing of the "legacy" renderer is also ultimately inevitable. Give it about 5 years or so.