mirror of
https://github.com/revanced/revanced-patcher.git
synced 2025-05-03 22:24:25 +02:00
perf: Use a map to merge integrations classes
This commit is contained in:
parent
444dee5a16
commit
6059d3ca26
@ -108,7 +108,8 @@ class BytecodeContext internal constructor(private val options: PatcherOptions)
|
|||||||
|
|
||||||
logger.info("Merging integrations")
|
logger.info("Merging integrations")
|
||||||
|
|
||||||
// TODO: Multi-thread this.
|
val classMap = classes.associateBy { it.type }
|
||||||
|
|
||||||
this@Integrations.forEach { integrations ->
|
this@Integrations.forEach { integrations ->
|
||||||
MultiDexIO.readDexFile(
|
MultiDexIO.readDexFile(
|
||||||
true,
|
true,
|
||||||
@ -116,8 +117,8 @@ class BytecodeContext internal constructor(private val options: PatcherOptions)
|
|||||||
null,
|
null,
|
||||||
null
|
null
|
||||||
).classes.forEach classDef@{ classDef ->
|
).classes.forEach classDef@{ classDef ->
|
||||||
val existingClass = classes.find { it.type == classDef.type } ?: run {
|
val existingClass = classMap[classDef.type] ?: run {
|
||||||
logger.fine("Merging $classDef")
|
logger.fine("Adding $classDef")
|
||||||
classes.add(classDef)
|
classes.add(classDef)
|
||||||
return@classDef
|
return@classDef
|
||||||
}
|
}
|
||||||
@ -131,7 +132,6 @@ class BytecodeContext internal constructor(private val options: PatcherOptions)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
clear()
|
clear()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user