Hey blink-dev, I plan to promote the new CSS Parser to stable in the next few days. This is an entirely hand-written parser, based on the CSS Syntax Module Level 3 spec, which will replace the existing Bison CSS Parser. The flag flip will make all CSS parsing use the new parser, aside from when the inspector uses a CSSParserObserver (I’ll add support for this soon). If all goes well, I intend to remove the Bison parser shortly after the M43 branch, which will allow simplifying some of the interactions between the parser implementation and the rest of Blink. Performance: I tested parsing performances of various stylesheets gathered from the internet on a Nexus 7 (2013 model). On most stylesheets, the new parser performed 15-25% faster. https://docs.google.com/a/chromium.org/spreadsheets/d/1pItJ74dODk6x26JNvp35OrCh6x8gtpviX-I9lt3VtVo/edit#gid=1791732769 Spec compliance: http://dev.w3.org/csswg/css-syntax The new implementation generally adheres to the spec very closely. The differences from the spec I’m aware of are all very small and match existing behaviour (we still create <unicode-range-token>s even though they were removed from the spec a few months ago, we don’t yet handle at-rules in declaration lists, we don’t drop descriptors with !important, we don’t yet insert comment tokens during serialization where needed). There are also a number of small behaviour changes from the Bison parser, which are listed at https://crrev.com/1015303002/. Future work: While the parser rewrite has been primarily a code-health effort, this also enables CSS Custom Properties work to proceed. This also opens up various possibilities in the future, such as off-main-thread parsing (some of the interfaces to the rest of the codebase use AtomicStrings, but everything else should be thread-safe), lazily parsing declaration blocks, and interruptible parsing. There’s also plenty of clean-up to do after removing the Bison parser (the largest of these is making the CSSPropertyParser use CSSParserTokens directly). Cheers, Timothy Loh
Hey blink-dev, I plan to promote the new CSS Parser to stable in the next few days. This is an entirely hand-written parser, based on the CSS Syntax Module Level 3 spec, which will replace the existing Bison CSS Parser. The flag flip will make all CSS parsing use the new parser, aside from when the inspector uses a CSSParserObserver (I’ll add support for this soon). If all goes well, I intend to remove the Bison parser shortly after the M43 branch, which will allow simplifying some of the interactions between the parser implementation and the rest of Blink. Performance: I tested parsing performances of various stylesheets gathered from the internet on a Nexus 7 (2013 model). On most stylesheets, the new parser performed 15-25% faster. https://docs.google.com/a/chromium.org/spreadsheets/d/1pItJ74dODk6x26JNvp35OrCh6x8gtpviX-I9lt3VtVo/edit#gid=1791732769 Spec compliance: http://dev.w3.org/csswg/css-syntax The new implementation generally adheres to the spec very closely. The differences from the spec I’m aware of are all very small and match existing behaviour (we still create <unicode-range-token>s even though they were removed from the spec a few months ago, we don’t yet handle at-rules in declaration lists, we don’t drop descriptors with !important, we don’t yet insert comment tokens during serialization where needed). There are also a number of small behaviour changes from the Bison parser, which are listed at https://crrev.com/1015303002/. Future work: While the parser rewrite has been primarily a code-health effort, this also enables CSS Custom Properties work to proceed. This also opens up various possibilities in the future, such as off-main-thread parsing (some of the interfaces to the rest of the codebase use AtomicStrings, but everything else should be thread-safe), lazily parsing declaration blocks, and interruptible parsing. There’s also plenty of clean-up to do after removing the Bison parser (the largest of these is making the CSSPropertyParser use CSSParserTokens directly). Cheers, Timothy Loh
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
Great work! A question though:Since your parser adheres closely to the spec, what is the likelihood of web compatibility issues?Chris
Do we have a telemetry benchmark that captures parse times? Presumably you could copy the layout benchmarks from benjhayden...
On Sat, Mar 28, 2015 at 4:20 AM, Nat Duca <nd...@chromium.org> wrote:Do we have a telemetry benchmark that captures parse times? Presumably you could copy the layout benchmarks from benjhayden...I had a look at the perf dashboard and there's at least blink_perf.parser/css-parser-yui and blink_perf.css/StyleSheetInsert-bootstrap. The tests blink_perf.parser/html-parser and blink_perf.parser/html5-full-render also showed a small improvement on some bots. Eventually we'll probably have a suite of benchmarks which report on parsing/selector matching/property application/etc.
Hey blink-dev, I plan to promote the new CSS Parser to stable in the next few days.
One string management question: I learned a few years back that there are huge (many hundred KB, maybe MB) CSS files used by common sites because they embed fonts. At the same time most CSS documents are very close to 100% ASCII, but not always 100% (small unicode symbol characters come to mind).Will large strings (fonts) be stored in ASCII if possible?