|
|
|
|
|
by pcwalton
3284 days ago
|
|
Games are at an advantage because they can do a lot of up-front processing. They can statically schedule their content based on knowledge of the hardware, and programmers can and do even tell the artists to tailor their content directly to the system. Conversely, on the Web, we can't do any of this: we have no idea what the content is going to be like until we receive it, and we have to handle specifications that were written without parallelism in mind. All of the decisions we make have to be dynamic rather than static, which is why work stealing is especially effective. Besides, vertices are a much simpler problem than CSS styling. CSS supports hundreds of properties, all of which are parsed and cascaded differently. You have properties that are inherited and properties that are noninherited. You have properties that depend on other properties: for example, any lengths might be specified in terms of ems, which means you have to have resolved the font size first. You have properties that result in completely different render trees, for example "display". You can't effectively throw stream processors like GPUs at the problem (believe me, I've tried). Could we do better? Sure. But every proposed replacement for CSS I've seen (e.g. Cassowary) has made the complexity problem worse. And most native styling solutions I've seen are usually just very slow implementations of CSS. Separating presentation and markup is just hard, no matter what. |
|
Hi, what other proposed replacements for CSS do you know about? I'm interested in seeing what problems they ran into.
I need to go look at Cassowary again. IIRC it's a solver, so sometimes the layout won't be what you expected, and it's very hard to know what to change such that it does what you want.