mirror of
https://github.com/revanced/revanced-patcher
synced 2024-11-20 16:19:21 +01:00
perf: Use smallest lookup map for strings
This commit is contained in:
parent
6712f0ea72
commit
1358d3fa10
@ -72,10 +72,9 @@ class Fingerprint internal constructor(
|
||||
internal fun matchOrNull(): Match? {
|
||||
if (_matchOrNull != null) return _matchOrNull
|
||||
|
||||
val lookupMaps = lookupMaps
|
||||
|
||||
// Find the first
|
||||
var match = strings?.firstNotNullOfOrNull { lookupMaps.methodsByStrings[it] }?.let { methodClasses ->
|
||||
var match = strings?.mapNotNull {
|
||||
lookupMaps.methodsByStrings[it]
|
||||
}?.minByOrNull { it.size }?.let { methodClasses ->
|
||||
methodClasses.forEach { (classDef, method) ->
|
||||
val match = matchOrNull(classDef, method)
|
||||
if (match != null) return@let match
|
||||
@ -83,7 +82,6 @@ class Fingerprint internal constructor(
|
||||
|
||||
null
|
||||
}
|
||||
|
||||
if (match != null) return match
|
||||
|
||||
classes.forEach { classDef ->
|
||||
|
Loading…
Reference in New Issue
Block a user