mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-03 15:16:14 +00:00
LibWeb: Remove most of the copying of CSS::Parser::ComponentValue
This class was being copied all over the place, however, most of these cases can be easily prevented with `auto const&` or `NonnullRawPtr<>`. It also didn't have a move constructor, causing `Vector` to copy on every resize as well. Removing all these copies results in an almost 15% increase in performance for CSS parsing, as measured with callgrind.
This commit is contained in:
committed by
Sam Atkins
parent
e50b9f5478
commit
0de9818470
@@ -121,7 +121,7 @@ NonnullRefPtr<MediaQuery> Parser::parse_media_query(TokenStream<ComponentValue>&
|
||||
return media_query;
|
||||
|
||||
// `[ and <media-condition-without-or> ]?`
|
||||
if (auto maybe_and = tokens.consume_a_token(); maybe_and.is_ident("and"sv)) {
|
||||
if (auto const& maybe_and = tokens.consume_a_token(); maybe_and.is_ident("and"sv)) {
|
||||
if (auto media_condition = parse_media_condition(tokens, MediaCondition::AllowOr::No)) {
|
||||
tokens.discard_whitespace();
|
||||
if (tokens.has_next_token())
|
||||
|
||||
Reference in New Issue
Block a user