12 ms·
Acid2 pass itself maybe uninteresting, but Servo also does layout in parallel (right now, not in the future). No other engines do. http://pcwalton.github.io/bl
by sanxiyn 13y ago
Acid2 pass itself maybe uninteresting, but Servo also does layout in parallel (right now, not in the future). No other engines do.
http://pcwalton.github.io/blog/2014/02/25/revamped-parallel-layout-in-servo/ http://pcwalton.github.io/blog/2014/02/25/revamped-parallel-...
- haberman 13y agoWow, Servo is way longer along than I thought! From that post: > No doubt about it, CSS 2.1 is tricky—floats perhaps more than anything else. I really hope that Servo helps to identify parts of the HTML/CSS specs (if any) that unnecessarily prevent parallelism. By that I mean features (like "float" perhaps) that make it harder to parallelize, and where an alternative design could support the same use cases in a better way. Those are the gems that teach us deep lessons about the problem space, and how future similar technologies out to be designed.
- mbrubeck 13y ago> I really hope that Servo helps to identify parts of the HTML/CSS specs (if any) that unnecessarily prevent parallelism. This is beginning to happen; for example Servo work on running <iframe sandboxed> documents in parallel [1] led to the discovery that the HTML spec allowed different-origin iframes to mutate into same-origin, through the "document.domain" setter [2], which made process isolation infeasible (since it would require some way to merge separate processes with separate heaps back into a single process). That discussion led to a change in the spec [3]. [1] https://groups.google.com/forum/#!msg/mozilla.dev.servo/LQ46AtKp_t0/plqFfjLSER8J https://groups.google.com/forum/#!msg/mozilla.dev.servo/LQ46... [2] http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2013-August/040433.html http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2013-Aug... [3] https://www.w3.org/Bugs/Public/show_bug.cgi?id=23040 https://www.w3.org/Bugs/Public/show_bug.cgi?id=23040
- dingdingdang 13y agoCSS without float.. would not work very well! Unless we all go back to table based design (or ahead to flexbox I guess, I don't know enough, practically speaking, about that standard yet to reason proper about it though!)
- ehsanu1 13y agoIf you clear your floats, you'll be fine in terms of giving the engine room to parallelize, according to pcwalton's blog post.
- oneeyedpigeon 13y agoDoes that 'allow' the classic use case of floats - potentially, what should be the only use of floats - wrapping text around an image? I feel like the answer would be "no", yet there's no good alternative for achieving this common requirement, which would cause a snag.
- ehsanu1 13y agoI believe you're right. But I don't think this is a huge problem: you simply don't get the benefits of layout out that specific text in parallel, it'll render sequentially as browsers tend to do today anyways. You can still get parallelization in other flows outside of the container of the floating elements.
- azakai 13y agoI believe it does, yes. The point is that when you clear them later, the browser has a static guarantee that that float will not matter anymore. So the complexity due to the float is only relevant until the clear, and it can parallelize before and after the clear.
- pcwalton 13y agoIf you know you need to use floats to flow text around elements, feel free to use them! They're in CSS for a reason :) But if there are alternatives (such as absolute positioning) that work equally well in your particular design, then choosing an alternative may help you gain better performance.
- scotth 13y agoFlexboxes don't really help. The reason that floats exist is so that elements can flow around them.
- goalieca 13y agoI imagine that is quite a huge feat! Here's a questions for the HN gurus though: how much of a browsers code deals with errors, compatibility, and legacy?? I imagine A LOT.
- mbrubeck 13y agoFortunately, even the backward-compatibility quirks modes have a spec now: http://quirks.spec.whatwg.org/ http://quirks.spec.whatwg.org/ Just having more and more of this stuff documented (instead of having to reverse-engineer it from existing browsers) makes things a lot easier than they once were.
- gsnedders 13y agoArguably a large part of the interest in Servo is whether the specs are good enough that developing a new browser from scratch is now feasible — certainly, yes, there is a lot of institutional knowledge around Mozilla, but a from-scratch implementation isn't going to exactly match Gecko everywhere.
- pcwalton 13y agoAgreed 100%. We want to be part of the conversation as to how to make future CSS parallelizable and amenable to modern hardware, both to educate Web authors as to how to make fast content and to shape the work done in the relevant committees.
- nly 13y agoDoes the lack of a multi-threaded layout engine really matter? Don't pages load fast enough already? And if layout performance really is becoming a problem, particularly in cases of dynamic DOM manipulation etc, isn't that largely the fault of the spec? Even shiny HTML5 is hardly designed for fiendishly complex UI layouts... it's an abomination for programmers and designers alike, and always has been. To this day it still requires herculean effort to achieve things that are trivial with real UI toolkits or publishing tools. I guess now we're in this hole we best keep digging
- wmf 13y agoHTML layout is not super-fast on low-end phones, and due to marketing stupidity those phones have 4-8 slow cores instead of 1-2 fast cores. I imagine Servo could do well there. Drastically changing the HTML standard would take even longer than developing Servo.
- cpeterso 13y ago> due to marketing stupidity those phones have 4-8 slow cores instead of 1-2 fast cores. Beyond marketing, wouldn't more slow cores consume less battery power than fewer fast cores?
- ehsanu1 13y agoYes, this is also part of Servo's strategy apparently: spread work across multiple cores, but each core does less and can be more efficient in terms of power draw. Faster + less battery use in one fell swoop. Though it's not really clear to me why this actually results in an efficiency win over maxing out a single core.
- pcwalton 13y agoThe way I've heard it, as a very imprecise rule of thumb, increasing clock speed scales power consumption quadratically, while adding CPUs increases power consumption linearly. So, very roughly speaking, one 1.6 GHz CPU uses twice as much power as two 800 MHz CPUs.
- gfody 13y agowhy all the effort to build the flow tree? can't any block be rendered in parallel to a buffer and then copied into the correct location once all the widths and heights are known? in the examples given it seems like all blocks including the green one could be rendered in parallel to separate buffers.
- sanxiyn 13y agoLayout is precisely about learning all the widths and heights. No rendering whatsoever happens in layout. And as you pointed out, rendering can be parallelized rather easily.