7 ms·
"(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 s
by jerf 8y ago
"(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.)"
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.
- digi_owl 8y agoFrom personal experience, any site will render quickly of you kill the 10+ externally sourced JS frameworks it loads (or it will just show a white on white page that you can throw reader mode at). Frankly what went wrong was that print media designers got involved and used flash and JS to turn static text into virtual pamphlets etc.
- mamcx 8y agoI wonder why browser makers not take full advantage of the high churn of the JS ecosystem to move forward. Let put a end to the madness, and say "after 2020, not more in the old apis" and do a clean standard. Then take advantage of the fact html/js have tags that could declare versions, and when a old page show, use the old rendered, and when a new, use the clean one. By then, most PC/mobile devices are powerfull enough to have 2 renders alive and the transition will be fast for more big/popular sites.
- joshvm 8y agoBack to doctypes? I remember as a younger person being very confused at why there were about five different options. Do I use strict? transitional? xhtml? There are multiple versions of ECMAScript, analogous to whether your compiler supports C++11/14/17/etc. It doesn't make sense to say "let's all use ES8" because ES8 is back-compatible (I think). It's up to the browser to decide what to support, and you have the same issues in C++ where some compilers don't fully support feature X. Then, which APIs do you deprecate? How do you define "old"? Anything prior to stable is a good rule of thumb, but since JS can be loaded locally, people will use whatever they downloaded and that they know works. Some people advise not to use auto-updating CDNs precisely because a patch might break your page. And remember it's mostly down to the API developers to ensure compatibility across major browsers, not vice versa. There's nothing wrong with vanilla JS. Really we just need to get people to be less excited about using frameworks for tiny projects that don't require them. Or you have problems like e.g. some text transition that requires loading every single version of the typeface.
- kerng 8y agoYes, reminds me of "we have 14 different standards. Let's implement a new one that encompasses all that is needed and obsolete the other ones. Now, we have 15 different standards"
- amaccuish 8y agoCredit where it's due: https://xkcd.com/927/ https://xkcd.com/927/
- mamcx 8y agoBut this is exactly what is happened, just that every new one is ad-hoc, and on top of the olds. Every time a new api happened you create standard + 1 * N browsers. Eventually, you increase ad infinitum the tech debt, or restart. I think the cost of the whole web stack is high enough not only for the browser makers but EVERYONE ELSE. Is multiply JS (n-versions) + CSS(n-versions) + HTML(n-versions) * N Browser * N OS. Now, what other rational option can be offered... push forward and keep doing the same and increase the tech debt? Not exist a way to refactor this?
- stcredzero 8y ago"(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.)" At my job, our group recently refactored a file from over 30000 lines down to 17000. I've also seen, on multiple occasions, single methods in Smalltalk applications that exceeded 32KB and therefore broke the compiler! (The egregious sins of Smalltalk shops were weirdly parallel. The egregious sins of Smalltalk vendors were also weirdly parallel, come to think of it.)
- sevensor 8y agoHoly cow, in Smalltalk? I thought it was considered exceptionally bad form in Smalltalk to write a method that didn't all fit on your screen.
- deleted 8y ago[deleted]
- stcredzero 8y agoI've seen entire major subsystems written without a single instance variable and without a single instance method -- in Smalltalk -- in an application responsible for multi billions of dollars in transactions at a Fortune 500 company. The depths of how bad is, in bad corporate code is kind of amazing. Though in fairness, I think those super long methods resulted from auto-generated methods that became cut and paste hand maintained.
- sevensor 8y agoYikes. I've seen that in small scale, with copypasted auto-generated code (although not Smalltalk) reaching 5k lines or so at a manufacturing company. But what you're talking about is a whole other level of bad.
- moron4hire 8y ago"all written by people who were not, personally, the ones implementing them" I don't think that's true. At least, all the browser standardization processes I've been involved in included several people who would be responsible for actual implementation.