4 ms·
Honestly, if SCSS works, then I don’t see how they can say it’ll be a problem in the browser. It already works, lets not require everyone to redo everything the
by Aeolun 4y ago
Honestly, if SCSS works, then I don’t see how they can say it’ll be a problem in the browser. It already works, lets not require everyone to redo everything they already have.
Have the browser show a warning in the style of “An unbounded lookahead is making this page slow” when, and if it happens, and the site owner can do something about that crazy thing.
- its_bbq 4y agoYes but the cost is paid once by the developer at compile time. I'm this case, the cost would be paid by every visitor on every page visit
- Aeolun 4y agoThat’s already true for all the Javascript tracking and ads. It seems silly to now worry about a few extra ms that it takes the CSS parser to resolve it’s difficulties. Maybe if they specified how long this ‘infinite’ lookahead takes in all their scenarios, it would be more compelling.
- its_bbq 4y agoTracking and ads scripts aren't special here. Yes page rendering is paid by the browser every time, and this group of people is specifically worried about the CSS part of that process. They're separate concerns and don't need to influence each other design wise
- seba_dos1 4y agoAlso, CSS is often used in other contexts than web browsing as well.
- LocalPCGuy 4y agoThat feels like a very user-hostile point of view. It's better to spend a bit of time to get this right rather than just doing it in a way that affects millions of web users.
- Spivak 4y agoYes but that cat is so far out of the bag that it's meaningless. The browser's model is "ship source code, and we compile and run it." I would love a universe where it would be possible to ship some binary artifact to browsers so that it can load it as if it was an already opened page, complete with local state and skip all the parsing/compiling steps.
- LocalPCGuy 4y agoMeh - every step down that road has been fraught with significant issues. See: Flash or Silverlight, for example. (Yes, I know, not quite the same as if the browser did it natively.) One of the beautiful things about the web is the ability to jump into the dev tools and look at the code. I know it's harder than ever to actually learn from that now, and I predict you are correct that someday we'll get to the point where it's a binary blob delivered. But I'm not holding my breath waiting for it and certainly not advocating for it. I'll adapt when/if it happens, but I feel a bit of the "magic" of the web will die that day.
- adam_arthur 4y agoAgreed. What's the real performance cost of the lookahead on an average/decently written page? Terrible philosophy to base the design on implementation details of the engine. Unless it can be shown that performance will degrade significantly for the average page, which I suspect not
- r3trohack3r 4y agoI don’t know that I’d call this an implementation detail of the engine. As I read this, the spec would force the implementation on every engine - and there is no known algorithm that could answer the question in constant time given the spec. Infinite look ahead means infinite look ahead. Which means (IIUC), every time this case is encountered, any/every CSS engine (existing today or yet to be built - every CSS engine from this point forward) would have to potentially check every subsequent token until it could properly understand the context of the symbol. Given that - I don’t like the idea of any CSS file being able to put my browser into that state.
- adam_arthur 4y agoCorrect me if I'm wrong, but my interpretation of the lookahead is that performance only degrades once CSS becomes deeply nested. That the need to lookahead only applies to syntax nested within another block. It's not a realistic use case for somebody to nest CSS more than a few levels deep, and if the lookahead is a known part of the spec it would become a best practice not to excessively nest things. So with side by side implementations, what's the cost in time/CPU of a realistically scoped CSS file with a realistic level of nesting? That's the answer I'd like to know. Optimizing for an avoidable theoretical worst case shouldn't be a major consideration in design. The net result of using a weird syntax for nesting is that developers will just keep using preprocessors forever because they're far more ergonomic. So all the spec saves is some built file size, while not improving anything about the development process
- miragecraft 4y agoIt's the classic chicken and egg problem. The lookahead only need to be applied to nested selectors. But you can't know whether something is a nested selector until AFTER you applied the lookahead.