Bug 1684673 - Inline nsTArray::deref. r=xidorn

This shaves >50ms if the compiler decides not to inline it, compilers are
sometimes dumb.

Depends on D100593

Differential Revision: https://phabricator.services.mozilla.com/D100594
This commit is contained in:
Emilio Cobos Álvarez 2021-01-02 17:37:45 +00:00
parent c260c526dc
commit 38bd2ea5d8

View File

@ -13,6 +13,7 @@ use std::slice;
impl<T> Deref for nsTArray<T> {
type Target = [T];
#[inline]
fn deref<'a>(&'a self) -> &'a [T] {
unsafe { slice::from_raw_parts(self.slice_begin(), self.header().mLength as usize) }
}