gecko-dev/servo/python
Simon Sapin dfae784318 servo: Merge #16954 - Avoid returning / passing around a huge ParsedDeclaration type (from servo:arrayvec); r=emilio
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
2017-05-19 18:37:14 -05:00
..
servo servo: Merge #16954 - Avoid returning / passing around a huge ParsedDeclaration type (from servo:arrayvec); r=emilio 2017-05-19 18:37:14 -05:00
tidy servo: Merge #16893 - Implement WebGL extensions (from MortimerGoro:webgl_extensions); r=emilio 2017-05-19 01:09:48 -05:00
mach_bootstrap.py servo: Merge #16490 - Remove windows gnu part 2 (from aneeshusa:remove-windows-gnu-part-2); r=metajack 2017-04-16 21:38:05 -05:00
README.md servo: Merge #10984 - Minor python/README fixes (from frewsxcv:python-cleanup); r=metajack 2016-05-03 03:20:19 -07:00
requirements-salt.txt servo: Merge #14974 - Use Salt for mach bootstrap (from aneeshusa:add-mach-bootstrap); r=metajack 2017-01-19 20:58:19 -08:00
requirements.txt servo: Merge #14974 - Use Salt for mach bootstrap (from aneeshusa:add-mach-bootstrap); r=metajack 2017-01-19 20:58:19 -08:00
tox.ini servo: Merge #11073 - Added tox.ini (from autrilla:tox); r=Ms2ger 2016-05-09 01:37:09 -07:00

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.