mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Store nsDynamicAtom's chars after the end of the object.
This reduces memory usage because we only need one allocation instead of two for the dynamic atom and its chars, and because we don't need to store a refcount and a size. It precludes sharing of chars between dynamic atoms, but we weren't benefiting much from that anyway. This reduces per-process memory usage by up to several hundred KiB on my Linux64 box. One consequence of this change is that we need to allocate + copy in DOMString::SetKnownLiveAtom(), which could make some things slower. Bug: 1447951 Reviewed-by: froydnj
This commit is contained in:
parent
ce7b6616fb
commit
46e572a497
1 changed files with 2 additions and 1 deletions
|
@ -122,7 +122,8 @@ impl WeakAtom {
|
|||
unsafe { u8_ptr.offset(string_offset) as *const u16 }
|
||||
} else {
|
||||
let atom_ptr = self.as_ptr() as *const nsDynamicAtom;
|
||||
unsafe { (*(atom_ptr)).mString }
|
||||
// Dynamic atom chars are stored at the end of the object.
|
||||
unsafe { atom_ptr.offset(1) as *const u16 }
|
||||
};
|
||||
unsafe { slice::from_raw_parts(string, self.len() as usize) }
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue