Skip to content

Commit cfd0ca2

Browse files
committed
automata/meta: force some prefilter inlining
In some ad hoc profiling, I noticed an extra function call that really didn't need to be there.
1 parent 25ad29f commit cfd0ca2

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

regex-automata/src/meta/strategy.rs

+6
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,7 @@ impl Pre<()> {
353353
// strategy when len(patterns)==1 if the number of literals is large. In that
354354
// case, literal extraction gives up and will return an infinite set.)
355355
impl<P: PrefilterI> Strategy for Pre<P> {
356+
#[cfg_attr(feature = "perf-inline", inline(always))]
356357
fn group_info(&self) -> &GroupInfo {
357358
&self.group_info
358359
}
@@ -378,6 +379,7 @@ impl<P: PrefilterI> Strategy for Pre<P> {
378379
self.pre.memory_usage()
379380
}
380381

382+
#[cfg_attr(feature = "perf-inline", inline(always))]
381383
fn search(&self, _cache: &mut Cache, input: &Input<'_>) -> Option<Match> {
382384
if input.is_done() {
383385
return None;
@@ -393,6 +395,7 @@ impl<P: PrefilterI> Strategy for Pre<P> {
393395
.map(|sp| Match::new(PatternID::ZERO, sp))
394396
}
395397

398+
#[cfg_attr(feature = "perf-inline", inline(always))]
396399
fn search_half(
397400
&self,
398401
cache: &mut Cache,
@@ -401,10 +404,12 @@ impl<P: PrefilterI> Strategy for Pre<P> {
401404
self.search(cache, input).map(|m| HalfMatch::new(m.pattern(), m.end()))
402405
}
403406

407+
#[cfg_attr(feature = "perf-inline", inline(always))]
404408
fn is_match(&self, cache: &mut Cache, input: &Input<'_>) -> bool {
405409
self.search(cache, input).is_some()
406410
}
407411

412+
#[cfg_attr(feature = "perf-inline", inline(always))]
408413
fn search_slots(
409414
&self,
410415
cache: &mut Cache,
@@ -421,6 +426,7 @@ impl<P: PrefilterI> Strategy for Pre<P> {
421426
Some(m.pattern())
422427
}
423428

429+
#[cfg_attr(feature = "perf-inline", inline(always))]
424430
fn which_overlapping_matches(
425431
&self,
426432
cache: &mut Cache,

0 commit comments

Comments
 (0)