Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pack bloom filter hashes better and save a word on Rule #17281

Merged
merged 6 commits into from Jun 12, 2017

Make source_order u32 and shrink Rule.

MozReview-Commit-ID: AKNTZZqke1O
  • Loading branch information
bholley committed Jun 12, 2017
commit 3afab1400a10d2509e1dbead177c3126403e88ee
@@ -121,7 +121,7 @@ pub struct Stylist {

/// A monotonically increasing counter to represent the order on which a
/// style rule appears in a stylesheet, needed to sort them by source order.
rules_source_order: usize,
rules_source_order: u32,

/// Selector dependencies used to compute restyle hints.
dependencies: DependencySet,
@@ -1497,11 +1497,11 @@ pub struct Rule {
/// The ancestor hashes associated with the selector.
#[cfg_attr(feature = "servo", ignore_heap_size_of = "No heap data")]
pub hashes: AncestorHashes,
/// The source order this style rule appears in.
pub source_order: u32,
/// The actual style rule.
#[cfg_attr(feature = "servo", ignore_heap_size_of = "Arc")]
pub style_rule: Arc<Locked<StyleRule>>,
/// The source order this style rule appears in.
pub source_order: usize,
}

impl SelectorMapEntry for Rule {
@@ -1537,7 +1537,7 @@ impl Rule {
pub fn new(selector: Selector<SelectorImpl>,
hashes: AncestorHashes,
style_rule: Arc<Locked<StyleRule>>,
source_order: usize)
source_order: u32)
-> Self
{
Rule {
@@ -1561,7 +1561,7 @@ pub struct ApplicableDeclarationBlock {
#[cfg_attr(feature = "servo", ignore_heap_size_of = "Arc")]
pub source: StyleSource,
/// The source order of this block.
pub source_order: usize,
pub source_order: u32,
/// The specificity of the selector this block is represented by.
pub specificity: u32,
/// The cascade level this applicable declaration block is in.
@@ -45,7 +45,7 @@ fn get_mock_rules(css_selectors: &[&str]) -> (Vec<Vec<Rule>>, SharedRwLock) {
let guard = shared_lock.read();
let rule = locked.read_with(&guard);
rule.selectors.0.iter().map(|s| {
Rule::new(s.selector.clone(), s.hashes.clone(), locked.clone(), i)
Rule::new(s.selector.clone(), s.hashes.clone(), locked.clone(), i as u32)
}).collect()
}).collect(), shared_lock)
}
@@ -27,7 +27,7 @@ fn size_of_selectors_dummy_types() {
// The size of this is critical to performance on the bloom-basic microbenchmark.
// When iterating over a large Rule array, we want to be able to fast-reject
// selectors (with the inline hashes) with as few cache misses as possible.
size_of_test!(test_size_of_rule, style::stylist::Rule, 40);
size_of_test!(test_size_of_rule, style::stylist::Rule, 32);

size_of_test!(test_size_of_option_arc_cv, Option<Arc<ComputedValues>>, 8);
size_of_test!(test_size_of_option_rule_node, Option<StrongRuleNode>, 8);
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.