mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-16 23:05:42 +00:00
dfae784318
This enum type used to contain the result of parsing one CSS source declaration (`name: value;`) and expanding shorthands. Enum types are as big as the biggest of their variant (plus discriminant), which was quite big because some shorthands expand to many longhand properties. This type was returned through many functions and methods, wrapped and rewrapped in `Result` with different error types. This presumably caused significant `memmove` traffic. Instead, we now allocate an `ArrayVec` on the stack and pass `&mut` references to it for various functions to push into it. This type is also very big, but we never move it. We still use an intermediate data structure because we sometimes decide after shorthand expansion that a declaration is invalid after all and that we’re gonna drop it. Only later do we push to a `PropertyDeclarationBlock`, with an entire `ArrayVec` or nothing. In future work we can try to avoid a large stack-allocated array, and instead writing directly to the heap allocation of the `Vec` inside `PropertyDeclarationBlock`. However this is tricky: we need to preserve this "all or nothing" aspect of parsing one source declaration, and at the same time we want to make it as little error-prone as possible for the various call sites. `PropertyDeclarationBlock` curently does property deduplication incrementally: as each `PropertyDeclaration` is pushed, we check if an existing declaration of the same property exists and if so overwrite it. To get rid of the stack allocated array we’d need to somehow deduplicate separately after pushing multiple `PropertyDeclaration`. Source-Repo: https://github.com/servo/servo Source-Revision: 60682cf81fe19a82c73dd98ba4c1eebc1dbbfcac --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : bf9916ad96bb4c2eedcb7a52110170644c269133 |
||
---|---|---|
.. | ||
servo | ||
tidy | ||
mach_bootstrap.py | ||
README.md | ||
requirements-salt.txt | ||
requirements.txt | ||
tox.ini |
This directory contains various Python modules used to support servo development.
servo
servo-specific python code e.g. implementations of mach commands. This is the canonical repository for this code.
tidy
servo-tidy is used to check licenses, line lengths, whitespace, flake8 on Python files, lock file versions, and more.