From 03bb53999ae8be248259f6f0f3a62bb73d3e0445 Mon Sep 17 00:00:00 2001 From: lisonge Date: Mon, 4 Mar 2024 16:08:54 +0800 Subject: [PATCH] perf: rule index --- app/src/main/kotlin/li/songe/gkd/data/ResolvedRule.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/kotlin/li/songe/gkd/data/ResolvedRule.kt b/app/src/main/kotlin/li/songe/gkd/data/ResolvedRule.kt index 3135941..c4b4e5a 100644 --- a/app/src/main/kotlin/li/songe/gkd/data/ResolvedRule.kt +++ b/app/src/main/kotlin/li/songe/gkd/data/ResolvedRule.kt @@ -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) }