perf: rule index

This commit is contained in:
lisonge 2024-03-04 16:08:54 +08:00
parent 81ced236da
commit 03bb53999a

View File

@ -20,7 +20,7 @@ sealed class ResolvedRule(
val rawSubs = g.subscription
val config = g.config
val key = rule.key
val index = group.rules.indexOf(rule)
val index = group.rules.indexOfFirst { r -> r === rule }
private val preKeys = (rule.preKeys ?: emptyList()).toSet()
private val matches = rule.matches?.map { s -> Selector.parse(s) } ?: emptyList()
private val excludeMatches = (rule.excludeMatches ?: emptyList()).map { s -> Selector.parse(s) }