mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-02 00:17:41 +01:00
Add additional thread delete performance improvements.
This commit is contained in:
committed by
jeffrey-signal
parent
b0b2c32a6f
commit
02ce6c62a8
@@ -51,6 +51,7 @@ object BenchmarkMetrics {
|
||||
val threadDeletion: List<TraceSectionMetric>
|
||||
get() = listOf(
|
||||
TraceSectionMetric("ThreadTable#deleteConversations", Mode.Sum),
|
||||
TraceSectionMetric("MessageTable#deleteMessagesInThread", Mode.Sum)
|
||||
TraceSectionMetric("MessageTable#deleteMessagesInThread", Mode.Sum),
|
||||
TraceSectionMetric("deleteMessages", Mode.Sum)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -8,8 +8,11 @@ object BenchmarkSetup {
|
||||
private const val TARGET_PACKAGE = "org.thoughtcrime.securesms.benchmark"
|
||||
private const val RECEIVER = "org.signal.benchmark.BenchmarkCommandReceiver"
|
||||
|
||||
fun setup(type: String, device: UiDevice, timeout: Long = 25_000L) {
|
||||
device.executeShellCommand("pm clear $TARGET_PACKAGE")
|
||||
fun setup(type: String, device: UiDevice, timeout: Long = 25_000L, clearData: Boolean = true) {
|
||||
if (clearData) {
|
||||
device.executeShellCommand("pm clear $TARGET_PACKAGE")
|
||||
}
|
||||
|
||||
device.executeShellCommand("am start -W -n $TARGET_PACKAGE/org.signal.benchmark.BenchmarkSetupActivity --es setup-type $type")
|
||||
device.wait(Until.hasObject(By.textContains("done")), timeout)
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import androidx.benchmark.macro.junit4.MacrobenchmarkRule
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.uiautomator.By
|
||||
import androidx.test.uiautomator.Until
|
||||
import org.junit.Ignore
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
@@ -73,4 +74,26 @@ class ThreadDeletionBenchmarks {
|
||||
device.wait(Until.gone(By.textContains("Title")), 300_000L)
|
||||
}
|
||||
}
|
||||
|
||||
@Ignore("Needs locally provided backup file not available in CI yet")
|
||||
@Test
|
||||
fun deleteGroupThread20kMessagesWithBackupRestore() {
|
||||
benchmarkRule.measureRepeated(
|
||||
packageName = "org.thoughtcrime.securesms.benchmark",
|
||||
metrics = BenchmarkMetrics.threadDeletion,
|
||||
iterations = 1,
|
||||
compilationMode = CompilationMode.Partial(),
|
||||
setupBlock = {
|
||||
BenchmarkSetup.setup("backup-restore", device, timeout = 60_000L)
|
||||
killProcess()
|
||||
|
||||
startActivityAndWait()
|
||||
device.waitForIdle()
|
||||
device.wait(Until.findObject(By.textContains("CuQ75j")), 10_000)
|
||||
}
|
||||
) {
|
||||
BenchmarkSetup.deleteThread(device)
|
||||
device.wait(Until.gone(By.textContains("CuQ75j")), 300_000L)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user