selectors: Manually inline any(..) in matches_selector_list.

Since the compiler refuses to inline the inner closure even with -O3, which is
sad :(.

Sad try run:

  https://treeherder.mozilla.org/perf.html#/compare?originalProject=try&originalRevision=c2724c47e98f990826327da05220cd83b772d144&newProject=try&newRevision=52ac88b40a08a5ef6a629bd681f2e5a444b75f54&framework=1
This commit is contained in:
Emilio Cobos Álvarez 2017-12-14 06:32:48 +01:00
parent 11d32d8800
commit ddd3d126e9
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C

View file

@ -72,14 +72,24 @@ pub fn matches_selector_list<E>(
where
E: Element
{
selector_list.0.iter().any(|selector| {
matches_selector(selector,
// This is pretty much any(..) but manually inlined because the compiler
// refuses to do so from querySelector / querySelectorAll.
for selector in &selector_list.0 {
let matches = matches_selector(
selector,
0,
None,
element,
context,
&mut |_, _| {})
})
&mut |_, _| {},
);
if matches {
return true;
}
}
false
}
#[inline(always)]