servo/components
Simon Sapin d2be5239f5 Avoid returning / passing around a huge ParsedDeclaration type
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`.
2017-05-19 18:53:25 +02:00
..
atoms Allow 'decimal' and 'none' in <counter-style-name> 2017-04-26 13:04:27 +09:00
bluetooth
bluetooth_traits
canvas Bump cssparser to 0.13.3 2017-05-11 12:50:40 -07:00
canvas_traits Bump cssparser to 0.13.3 2017-05-11 12:50:40 -07:00
compositing Properly handle scroll offsets in hit testing 2017-05-16 15:27:09 +02:00
config Not headless by default 2017-05-17 09:52:40 +02:00
constellation Renamed constellation::Frame to constellation::BrowsingContext. 2017-05-15 21:03:11 -05:00
debugger
deny_public_fields
devtools Fix indentation errors in servo rust code that tidy now finds. 2017-04-18 14:56:13 -04:00
devtools_traits Update Hyper and OpenSSL 2017-03-31 16:32:21 +02:00
dom_struct
domobject_derive
geometry
gfx Auto merge of #16891 - kvark:preserve3d, r=glennw,emilio 2017-05-17 20:38:14 -05:00
gfx_traits Eliminate ScrollRootId 2017-04-20 08:51:38 +02:00
jstraceable_derive
layout Introduce CalcLengthOrPercentage::unclamped_length 2017-05-18 19:27:31 +02:00
layout_thread Auto merge of #16876 - asajeffrey:constellation-rename-frames, r=cbrewster 2017-05-16 23:10:45 -05:00
layout_traits Renamed constellation::Frame to constellation::BrowsingContext. 2017-05-15 21:03:11 -05:00
msg Renamed constellation::Frame to constellation::BrowsingContext. 2017-05-15 21:03:11 -05:00
net Ignore mime type parameters in nosniff 2017-05-15 14:43:45 +02:00
net_traits Stop using unstable slice_patterns feature 2017-05-01 14:19:00 -07:00
profile Implemented Houdini worklets. 2017-05-17 09:01:05 -05:00
profile_traits Implemented Houdini worklets. 2017-05-17 09:01:05 -05:00
rand
range
remutex Upgrade to rustc 1.19.0-nightly (ced823e26 2017-05-07) 2017-05-08 12:46:03 +02:00
script Avoid returning / passing around a huge ParsedDeclaration type 2017-05-19 18:53:25 +02:00
script_layout_interface Simplify rust-selectors API for attribute selectors 2017-05-18 17:13:13 +02:00
script_plugins Stop using unstable slice_patterns feature 2017-05-01 14:19:00 -07:00
script_traits Implemented Houdini worklets. 2017-05-17 09:01:05 -05:00
selectors Don’t visit attribute selectors that never match. 2017-05-18 17:13:20 +02:00
servo make gl context current on browser initialization 2017-05-17 09:25:51 +02:00
size_of_test Add size_of_test crate 2017-05-16 10:12:51 +02:00
style Avoid returning / passing around a huge ParsedDeclaration type 2017-05-19 18:53:25 +02:00
style_traits Auto merge of #16067 - Wafflespeanut:grid, r=nox,Wafflespeanut 2017-05-18 17:09:15 -05:00
url Remove servo feature from servo_url 2017-04-07 17:51:49 +10:00
webdriver_server Renamed constellation::Frame to constellation::BrowsingContext. 2017-05-15 21:03:11 -05:00
webvr Update WR (new groove/ridge border path, mix-blend-mode optimizations) 2017-04-26 14:34:07 +10:00
webvr_traits Implement Gamepad API 2017-04-12 15:43:14 +02:00