Skip to content

Commit cf3d20d

Browse files
author
bors-servo
authored
Auto merge of #183 - servo:jdm-patch-1, r=SimonSapin
Inline more parser methods. These showed up in some perf profiles as non-inlined parts of inlined parser methods. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/rust-cssparser/183) <!-- Reviewable:end -->
2 parents 2ec00aa + 9ce7287 commit cf3d20d

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "cssparser"
3-
version = "0.19.5"
3+
version = "0.19.6"
44
authors = [ "Simon Sapin <simon.sapin@exyr.org>" ]
55

66
description = "Rust implementation of CSS Syntax Level 3"

src/parser.rs

+6
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ pub enum BasicParseError<'a> {
5757
}
5858

5959
impl<'a, T> From<BasicParseError<'a>> for ParseError<'a, T> {
60+
#[inline]
6061
fn from(this: BasicParseError<'a>) -> ParseError<'a, T> {
6162
ParseError::Basic(this)
6263
}
@@ -200,16 +201,19 @@ mod ClosingDelimiter {
200201
impl BitOr<Delimiters> for Delimiters {
201202
type Output = Delimiters;
202203

204+
#[inline]
203205
fn bitor(self, other: Delimiters) -> Delimiters {
204206
Delimiters { bits: self.bits | other.bits }
205207
}
206208
}
207209

208210
impl Delimiters {
211+
#[inline]
209212
fn contains(self, other: Delimiters) -> bool {
210213
(self.bits & other.bits) != 0
211214
}
212215

216+
#[inline]
213217
fn from_byte(byte: Option<u8>) -> Delimiters {
214218
match byte {
215219
Some(b';') => Delimiter::Semicolon,
@@ -860,6 +864,8 @@ pub fn parse_nested_block<'i: 't, 't, F, T, E>(parser: &mut Parser<'i, 't>, pars
860864
result
861865
}
862866

867+
#[inline(never)]
868+
#[cold]
863869
fn consume_until_end_of_block(block_type: BlockType, tokenizer: &mut Tokenizer) {
864870
let mut stack = SmallVec::<[BlockType; 16]>::new();
865871
stack.push(block_type);

0 commit comments

Comments
 (0)