Skip to content
Permalink
Browse files

style: Use a RwLock'd HashMap instead of a lock-free linked list for …

…rule node children.

I need to profile this a bit more, but talos was pretty happy about this, and it
solves the known performance issues here such as the test-case from bug 1483963
for example. This also gets rid of a bunch of unsafe code which is nice.

This still keeps the same GC scheme, removing the key from the hashmap when
needed. I kept those as release assertions, but should probably be turned into
debug-only assertions.

Differential Revision: https://phabricator.services.mozilla.com/D6801
  • Loading branch information...
emilio committed May 29, 2019
1 parent 3652a0f commit f623a6c0450610d32c290ffa1e5991a621daf642
Showing with 95 additions and 191 deletions.
  1. +7 −0 components/servo_arc/lib.rs
  2. +88 −191 components/style/rule_tree/mod.rs
@@ -1305,11 +1305,18 @@ impl<A, B> ArcUnion<A, B> {
}

/// Returns true if the two values are pointer-equal.
#[inline]
pub fn ptr_eq(this: &Self, other: &Self) -> bool {
this.p == other.p
}

#[inline]
pub fn ptr(&self) -> ptr::NonNull<()> {
self.p
}

/// Returns an enum representing a borrow of either A or B.
#[inline]
pub fn borrow(&self) -> ArcUnionBorrow<A, B> {
if self.is_first() {
let ptr = self.p.as_ptr() as *const A;

0 comments on commit f623a6c

Please sign in to comment.
You can’t perform that action at this time.