159 points · by mattiemass · 10y ago · 62 comments
I'm frankly skeptical of most of Houdini, but I'm especially not happy with this one. This is baking the limitations of current browser engines into the platform for all time. The provided justification seems pretty flimsy to me, because effort that goes into this (which is something that native has no concept of, for good reason) could instead go into fixing the problems that make it seem like this is necessary.
1. What is an example of a new stylesheet feature that couldn't be implemented with Houdini in its current design?
2. Why will the current decisions being made on the Houdini APIs hold back further evolution of these APIs? In other words, why can't we go with a MVP and evolve as required?
I do wonder whether "as performant as native CSS features" is setting up unrealistic expectations. Same ballpark, maybe, but I'd have thought native will always be easier for browser vendors to optimize, even leaving aside the language/runtime differences (C++/Rust versus JS/WASM).
It will be. And things like the CSS Paint API are based on APIs that are poor matches for GPUs (but are easy for browsers of today to implement). I expect that those who are looking for Houdini for performance reasons will end up quite disappointed.
More broadly, I have seen the "replace the native implementation with a JavaScript implementation for better performance" idea tried many times, and I can't think of a single time it's actually worked.
Is that a misleading impression? Does Houdini have another agenda not covered by the article?
And definitely not as well as the latest and greatest.
Where you will see performance improvements is when developers create more expressive layouts/paints/etc. For example you can implement a grid layout with a bunch of nested flexboxes. You could also do it with the CSS Layout API. Because by using the CSS Layout API requires fewer divs, and maybe no N^2 layout passes, chances are it'll be faster.
But this really gets at the point of Houdini is to inform browsers/specs what is important. If a grid/masonary polyfill becomes widely used, then it will help inform CSS work.
Here is the idea: you declare your document to be in strict mode:
<!DOCTYPE strict>
In this mode you don't have access to any API unless you import it. You need to import CSS layout systems like regular box model or basic APIs like query selector. You also need to import each html element you use. This way browsers don't have to take into account every possible CSS property or html element when doing layout or painting.After we got that, then you can import your own implementation of standard modules that is written using APIs introduced by Houdini
Here is an example:
import "html/div"
import "css/flex"
import "dom/query"Reinventing the platform using JavaScript in that way is not going to be good for performance. At least right now, until at the very least shared memory multithreading is available.
I also want to call attention to this:
> This way browsers don't have to take into account every possible CSS property or html element when doing layout or painting.
But in order to get good performance we want to take every possible CSS property into account. Performance is about being able to make simplifying assumptions (especially on the GPU, where state changes are costly). We want to make global optimizations based on the contents of the whole page instead of having everything painted using programmatic APIs, which are black boxes to us.
And yes, I am being sarcastic here. I understand the motivation underpinning such projects, but the approach of introducing yet another complicated API with dubious cross-browser support is not something that will move the web forward in a meaningful way.
Next step would be having an ability to entirely reprogram the layout engine in newly-performant JS. And then more and more, until we have built an entire OS (again).
That's what Google Docs switched to so they could guarantee a consistent UI across different browser platforms.
For the full OS implementation see NodeOS and Runtime.js. NodeOS is a V8 runtime built on top of a very minimal linux kernel. Runtime.js is a full OS implementation from scratch written entirely in Javascript.
CSS doesn't need abstractions. It needs to be replaced.
Are you suggesting we style with JavaScript?
CSS is a big warty blob, and a relic of the "semantic web."
"Styling with JavaScript" is probably too verbose of a solution, but it's one option.
The only limitation I've run up against as far as responsive styling goes was that @media queries were always scoped to the browser's width/height, and I figured I could build much more advanced layouts if I had a way of scoping styles to individual elements. It turns out that's true, I have a plugin that lets me do this, so between regular CSS and these extra 'element queries' I have no issue styling anything I want. My plugin works down including IE8, so there's nowhere I need to write CSS where I can't use it.
I'm not aware of how/why CSS needs to be fixed or replaced, it's a great solution for what it does.
What do you propose instead of CSS? When you have well written HTML, it takes surprisingly few CSS declarations to add a good style!
Most of the time it's because they don't know how it works.
In short, there is a lot of inefficiency with the current system that preprocessors help alleviate.
(rather than those devs being "stupid", "ignorant", "incompetent" etc).
- when demonstrating a pattern present in CSS at a higher level, to educate people who write CSS
- when dealing with CSS animations where different browsers also use different properties
- when it's your job to output lots of different pieces of CSS based off the same pattern
Most of the time I'm either building new websites from scratch, or retrofitting old existing websites with responsive CSS and fixing problems. The web is written in three languages and only three languages: HTML, CSS, and JavaScript. If you're not writing one of those, you aren't writing the web. I can never be sure of the stack of the projects I'm going to be asked to fix, so if my requirement is: "Well I can fix it, but only as long as you use SASS" I'm going to be very hungry in life.
I can (and do write) CSS from my phone, tablet, and multiple computers - but if I had a SASS/Less workflow, that would severely limit the situations where I could write new code. Frontend web shouldn't need to be compiled!
Also, unless/until things like colour variables can also be used from JavaScript, I don't how useful CSS-only variables can really be.
In my experience, specializing specifically in responsive CSS - I've just never run into a situation where I needed or could make use of the features of SASS or Less (or Stylus, or others) where it didn't create more work for me, plus introduce technical debt into my projects, while simultaneously restricting which devices I could work from and on which sites I could work.
I could work that way, but I feel like I'd get 'Less' work done compared to the flexibility of pure CSS.
Frontend to frontend dev: what is it you reach for in SASS or Less that can't be done by CSS, JavaScript, and HTML?
Microsoft support end dates are darn helpful. Kicks people into gear.
Note that the Jan 12, 2016 End of Support date means there are no more security updates, non-security updates, free or paid assisted support options, or online technical content updates. https://support.microsoft.com/en-us/lifecycle#gp/Microsoft-I...