From 1e4b2c9c06d625a809bb703b65f8f4f7641f11e0 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Wed, 23 Aug 2017 14:20:33 -0700 Subject: [PATCH 1/3] Inline Delimiters methods. --- src/parser.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/parser.rs b/src/parser.rs index 1a232b9c..4035b10f 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -200,16 +200,19 @@ mod ClosingDelimiter { impl BitOr for Delimiters { type Output = Delimiters; + #[inline] fn bitor(self, other: Delimiters) -> Delimiters { Delimiters { bits: self.bits | other.bits } } } impl Delimiters { + #[inline] fn contains(self, other: Delimiters) -> bool { (self.bits & other.bits) != 0 } + #[inline] fn from_byte(byte: Option) -> Delimiters { match byte { Some(b';') => Delimiter::Semicolon, From d92137c1ef5aa0c8b1df9ede305622bc685f1fd3 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Wed, 23 Aug 2017 14:24:52 -0700 Subject: [PATCH 2/3] Inline From conversion for BasicParseError. --- src/parser.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/parser.rs b/src/parser.rs index 4035b10f..fbbc602a 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -57,6 +57,7 @@ pub enum BasicParseError<'a> { } impl<'a, T> From> for ParseError<'a, T> { + #[inline] fn from(this: BasicParseError<'a>) -> ParseError<'a, T> { ParseError::Basic(this) } From 9ce7287b0f1ffcd929c20e7f86bd7987ccffafb6 Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Sun, 27 Aug 2017 11:15:51 +0200 Subject: [PATCH 3/3] Make sure consume_until_end_of_block is not inlined. --- Cargo.toml | 2 +- src/parser.rs | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index b2120114..a896aa73 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cssparser" -version = "0.19.5" +version = "0.19.6" authors = [ "Simon Sapin " ] description = "Rust implementation of CSS Syntax Level 3" diff --git a/src/parser.rs b/src/parser.rs index fbbc602a..91f5e301 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -864,6 +864,8 @@ pub fn parse_nested_block<'i: 't, 't, F, T, E>(parser: &mut Parser<'i, 't>, pars result } +#[inline(never)] +#[cold] fn consume_until_end_of_block(block_type: BlockType, tokenizer: &mut Tokenizer) { let mut stack = SmallVec::<[BlockType; 16]>::new(); stack.push(block_type);