Bug 1684673 - Inline nsTArray::deref. r=xidorn
authorEmilio Cobos Álvarez <emilio@crisal.io>
Sat, 02 Jan 2021 17:37:45 +0000
changeset 561835 87dc458116789fe1bf79a9765aaf025f7d091e41
parent 561834 0a114ac95a422d422fe6ce991502c78f480fdb81
child 561836 636bed8f02dc5b95dd1c3572c09fa4bf9bb92aed
push id133427
push userealvarez@mozilla.com
push dateSat, 02 Jan 2021 17:40:19 +0000
treeherderautoland@87dc45811678 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersxidorn
bugs1684673
milestone86.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
servo/components/style/gecko_bindings/sugar/ns_t_array.rs
--- a/servo/components/style/gecko_bindings/sugar/ns_t_array.rs
+++ b/servo/components/style/gecko_bindings/sugar/ns_t_array.rs
@@ -8,16 +8,17 @@ use crate::gecko_bindings::bindings;
 use crate::gecko_bindings::structs::{nsTArray, nsTArrayHeader, CopyableTArray};
 use std::mem;
 use std::ops::{Deref, DerefMut};
 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) }
     }
 }
 
 impl<T> DerefMut for nsTArray<T> {
     fn deref_mut<'a>(&'a mut self) -> &'a mut [T] {
         unsafe { slice::from_raw_parts_mut(self.slice_begin(), self.header().mLength as usize) }