Skip to content

Commit

Permalink
servo: Merge #18171 - Use Parser::skip_whitespace in a few places to …
Browse files Browse the repository at this point in the history
…make Parser::try rewind less (from servo:skip_whitespace); r=emilio

**Do not merge yet.** This pulls in unrelated cssparser changes which add a dependency to `dota`, and we’d like to resolve dtolnay/dtoa#9 before landing dtoa in mozilla-central. Also, the dependency change may require manually revendoring in mozilla-central.

Gecko’s CSS parsing microbenchmarks before:

```
  43.437 ±  0.391 ms    Stylo.Servo_StyleSheet_FromUTF8Bytes_Bench
  29.244 ±  0.042 ms    Stylo.Gecko_nsCSSParser_ParseSheet_Bench
 281.884 ±  0.028 ms    Stylo.Servo_DeclarationBlock_SetPropertyById_Bench
 426.242 ±  0.008 ms    Stylo.Servo_DeclarationBlock_SetPropertyById_WithInitialSpace_Bench
```

After:

```
  29.779 ±  0.254 ms    Stylo.Servo_StyleSheet_FromUTF8Bytes_Bench
  28.841 ±  0.031 ms    Stylo.Gecko_nsCSSParser_ParseSheet_Bench
 296.240 ±  4.744 ms    Stylo.Servo_DeclarationBlock_SetPropertyById_Bench
 293.855 ±  4.304 ms    Stylo.Servo_DeclarationBlock_SetPropertyById_WithInitialSpace_Bench
```

Source-Repo: https://github.com/servo/servo
Source-Revision: 8812422bfa504633a7011b0b002e9a2682c7d045

UltraBlame original commit: 75a20ebcd6e8c43b2f0c332b6d5ce947ba1f5ad7
  • Loading branch information
marco-c committed Oct 1, 2019
1 parent dcec90d commit c3cb6db
Show file tree
Hide file tree
Showing 6 changed files with 184 additions and 122 deletions.
75 changes: 52 additions & 23 deletions servo/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions servo/components/selectors/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ cssparser
0
.
19
.
3
"
log
=
Expand Down
82 changes: 2 additions & 80 deletions servo/components/selectors/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8057,51 +8057,12 @@ new
(
)
;
loop
{
let
before_this_token
=
input
.
state
(
)
;
if
!
matches
!
(
input
.
next_including_whitespace
(
)
Ok
(
&
Token
:
:
WhiteSpace
(
_
)
)
)
{
input
.
reset
skip_whitespace
(
&
before_this_token
)
;
break
}
}
if
!
parse_type_selector
Expand Down Expand Up @@ -8285,51 +8246,12 @@ Impl
:
SelectorImpl
{
loop
{
let
before_this_token
=
input
.
state
(
)
;
if
!
matches
!
(
input
.
next_including_whitespace
(
)
Ok
(
&
Token
:
:
WhiteSpace
(
_
)
)
)
{
input
.
reset
skip_whitespace
(
&
before_this_token
)
;
break
}
}
let
mut
empty
Expand Down
2 changes: 2 additions & 0 deletions servo/components/style/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,8 @@ cssparser
0
.
19
.
3
"
encoding
=
Expand Down
Loading

0 comments on commit c3cb6db

Please sign in to comment.