惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Google DeepMind News
Google DeepMind News
C
CERT Recently Published Vulnerability Notes
C
Cisco Blogs
Cloudbric
Cloudbric
The Last Watchdog
The Last Watchdog
L
LINUX DO - 热门话题
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Application and Cybersecurity Blog
Application and Cybersecurity Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Security Archives - TechRepublic
Security Archives - TechRepublic
TaoSecurity Blog
TaoSecurity Blog
V2EX - 技术
V2EX - 技术
H
Heimdal Security Blog
S
Security Affairs
L
Lohrmann on Cybersecurity
Hacker News - Newest:
Hacker News - Newest: "LLM"
Simon Willison's Weblog
Simon Willison's Weblog
WordPress大学
WordPress大学
小众软件
小众软件
Security Latest
Security Latest
AWS News Blog
AWS News Blog
Apple Machine Learning Research
Apple Machine Learning Research
GbyAI
GbyAI
Engineering at Meta
Engineering at Meta
阮一峰的网络日志
阮一峰的网络日志
罗磊的独立博客
F
Full Disclosure
S
Schneier on Security
L
LangChain Blog
MyScale Blog
MyScale Blog
Know Your Adversary
Know Your Adversary
P
Privacy International News Feed
Google Online Security Blog
Google Online Security Blog
Scott Helme
Scott Helme
Stack Overflow Blog
Stack Overflow Blog
爱范儿
爱范儿
A
Arctic Wolf
Martin Fowler
Martin Fowler
B
Blog RSS Feed
大猫的无限游戏
大猫的无限游戏
博客园 - 三生石上(FineUI控件)
The Register - Security
The Register - Security
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
博客园_首页
Latest news
Latest news
F
Fortinet All Blogs
G
GRAHAM CLULEY
T
The Exploit Database - CXSecurity.com
Hacker News: Ask HN
Hacker News: Ask HN

David Baron's Weblog

Software engineering, responsibility, and ownership Software engineering, responsibility, and ownership David Baron's weblog: Security and Inequality Running animations on the compositor thread David Baron's weblog: Tying ecosystems through browsers David Baron's weblog: Payments on the Web Thoughts on migrating to a secure Web David Baron's weblog: The need for government David Baron's weblog: Priority of constituencies How browser developers should seek feedback from Web developers A possible approach to shorter release cycles David Baron's weblog: Fifteen years Why debug builds (and assertions) are important Ten years of the Mozilla Foundation Open licensing at the W3C Why adding compositing and blending to CSS is harder than it looks How you can help with removing -moz- prefixes Moving bug history out of the primary display of a bug report Beware of locale-specific behavior in the C library Eating dogfood and shipping software The bug system I wish I had CSS border-image changes and unprefixing Improving font size readability on Firefox for Android David Baron's weblog: CSS Animations, part 2 Hue-preserving color inversion with SVG filters Changes to handling of @-moz-keyframes David Baron's weblog: window.matchMedia() David Baron's weblog: CSS Animations What does a blur radius mean? Crash analysis in the future David Baron's weblog: calc() David Baron's weblog: colorDepth David Baron's weblog: Hidden complexity in specifications The most important field in a bug report: the summary WOFF font format submitted to W3C David Baron's weblog: :-moz-any() selector grouping setTimeout with a shorter delay Faster repainting in SVG foreignObject David Baron's weblog: Distributed Extensibility David Baron's weblog: Broadening crash analysis Correlating crashes with binary extensions or plugins David Baron's weblog: ex-HTML Downloadable font formats for the Web Web Accessibility as a Political Movement David Baron's weblog: CSS priorities David Baron's weblog: Bug priorities David Baron's weblog: Semi-vacation Some new CSS features in Firefox 3 David Baron's weblog: New selectors David Baron's weblog: The age of bugs Seeking a good Linux distribution David Baron's weblog: Teaching to the test David Baron's weblog: March 2008 David Baron's weblog: February 2008 David Baron's weblog: January 2008 David Baron's weblog: October 2007 David Baron's weblog: September 2007 David Baron's weblog: August 2007 David Baron's weblog: June 2007 David Baron's weblog: April 2007 David Baron's weblog: March 2007 David Baron's weblog: January 2007 David Baron's weblog: September 2006 David Baron's weblog: August 2006 David Baron's weblog: July 2006 David Baron's weblog: May 2006 David Baron's weblog: February 2006 David Baron's weblog: January 2006 David Baron's weblog: December 2005 David Baron's weblog: October 2005 David Baron's weblog: September 2005 David Baron's weblog: June 2005 David Baron's weblog: May 2005 David Baron's weblog: April 2005 David Baron's weblog: March 2005 David Baron's weblog: February 2005 David Baron's weblog: October 2004 David Baron's weblog: September 2004 David Baron's weblog: August 2004 David Baron's weblog: June 2004 David Baron's weblog: May 2004 David Baron's weblog: April 2004 David Baron's weblog: March 2004 David Baron's weblog: February 2004 David Baron's weblog: January 2004 David Baron's weblog: November 2003 David Baron's weblog: October 2003 David Baron's weblog: September 2003 David Baron's weblog: August 2003 David Baron's weblog: July 2003 David Baron's weblog: June 2003 David Baron's weblog: May 2003 David Baron's weblog: April 2003 David Baron's weblog: March 2003 David Baron's weblog: February 2003 David Baron's weblog: January 2003 David Baron's weblog: December 2002 David Baron's weblog: November 2002 David Baron's weblog: September 2002
Specification style and the future of the Web
David Baron · 2012-08-28 · via David Baron's Weblog

Today the Web browser market involves a bunch of competitors that have, as far as I'm aware, largely similar software architecture. While some components are done on other threads or in other processes (e.g., HTML parsing, some of the later stages of the rendering process, plugin execution), the bulk of the work for loading and displaying a Web page is done on a single thread.

This model isn't necessarily ideal for the long term. Today's advances in computing hardware are coming largely in the form of more cores rather than faster cores. The single-threaded browser doesn't take advantages of more cores. To do that, we need a more parallel browser.

There have been research projects (such as Leo Meyerovich's) with the goal of implementing a more parallel web browser. Mozilla's Servo project is a research project to build a parallel Web browser at the level of quality needed to really be used as a Web browser.

What have the people working on these projects discovered about implementing CSS in a parallel way? Much of it is quite doable. However, there are some parts of CSS, for example, layout involving floats (as Meyerovich and Bodik describe in Fast and Parallel Web Page Layout), that introduce a lot of extra complexity to parallel implementations, in the case of floats by requiring speculative work that might need to be thrown out depending on the result of another parallel task.

This leads to the question: what characteristics of CSS are difficult to implement in a parallel implementation, and how can we avoid creating more of them?

I suspect that one thing that is likely to affect whether a specification's requirements are easy or hard to implement in a parallel implementation is the manner in which it specifies layout algorithms. Compare:

Constraints related to an implementation strategy

Some specifications describe layout algorithms in terms of mathematical rules or constraints that correspond to the calculations that would happen in an implementation. For example, the rules on computing widths and margins in CSS 2.1 describe mathematical rules that are likely to appear in implementations in a form similar to the way they are described.

My gut feeling is that specifications written this way are likely to be the easiest to implement in new architectures such as parallel layout implementations.

Algorithms

Other specifications describe layout algorithms in terms of step-by-step algorithms to be followed. For example, the Flexible Box Layout Module describes the details of layout in terms of a step-by-step algorithm.

While specifications written this way may be easy to implement as described in a sequential implementation, I worry that they may be hard to optimize, and I worry that they may be hard to implement in a parallel implementation.

Constraints unrelated to an implementation strategy

Finally, other specifications describe layout rules in terms of a set of constraints that are actually pretty unrelated to how they are implemented. For example, CSS 2.1 describes rules for placement of floats in terms of a set of constraints such that the float must be placed as high as possible without violating the constraints, or (given a vertical position) as far to the left or right as possible without violating the constraints. However, these rules are completely unrelated to how they need to be implemented, because there is actually a complex interaction between these constraints and how lines are laid out. For example, rule 6 says:

6. The outer top of an element's floating box may not be higher than the top of any line-box containing a box generated by an element earlier in the source document.

In order to implement this, browsers have to deeply integrate the rules for float placement with the line breaking code, since:

  • the position of the float need not be at a line breaking opportunity,
  • the placement of a float next to a line reduces the amount of horizontal space available for that line
  • placing more items on the line may increase the height of the line, which might also (due to the presence of other floats) reduce the amount of horizontal space for the line

None of these interactions are mentioned in the constraints governing float placement. That the implementation of floats needs to be so disconnected from the way they are described in the specification might be related to how hard they are to implement. (See my earlier post on hidden complexity in specifications.)

I suspect these fake constraints are likely to lead to the most difficulty in implementing, both in sequential and parallel algorithms.

Over the past few years, we've been adding features to the Web very quickly. This means that the Web's complexity is also increasing very quickly, probably faster than it ever has before. And we need the Web to move quickly in order to compete with other less-open platforms. But as the Web becomes more powerful, I hope that we don't end up constraining its future too much, though I'm worried that we might be doing so.

Providing the new layout capabilities that flexbox provides is very important for the Web as a platform. But we still need to be careful when doing so; we can't judge them to be implementable based only on today's style of implementations, particularly when we know those implementations aren't sustainable in the long term. But my guesses as to what might or might not be implementable also aren't much good; we need real feedback from researchers who have worked on parallel implementations. And we need this feedback on tomorrow's Web technologies while those technologies are still being developed, rather than after they're already baked in to the Web.