Skip to content
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:
  • 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/
  2. +88 −191 components/style/rule_tree/
@@ -1305,11 +1305,18 @@ impl<A, B> ArcUnion<A, B> {

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

pub fn ptr(&self) -> ptr::NonNull<()> {

/// Returns an enum representing a borrow of either A or B.
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.