0

I am using Macrobenchmark library:

    @Test
    fun benchmarkStartup() = benchmarkRule.measureRepeated(
        packageName = TARGET_PACKAGE,
        metrics = listOf(StartupTimingMetric()),
        iterations = DEFAULT_ITERATIONS,
        startupMode = StartupMode.COLD,
        setupBlock = {
            pressHome()
        },
    ) {
        startActivityAndWait()
    }

The problem is, the first iteration aways returns an outlier result both in phsycal devices and emulators. Should I just ignore the first result or there is another solution for this problem?

            "metrics": {
                "timeToFullDisplayMs": {
                    "minimum": 5824.128018,
                    "maximum": 10358.624788,
                    "median": 6184.236352,
                    "runs": [
                        10358.624788, //<----
                        6097.023851,
                        6696.159112,
                        5824.128018,
                        6184.236352
                    ]
                },
                "timeToInitialDisplayMs": {
                    "minimum": 857.662655,
                    "maximum": 4681.589061,
                    "median": 906.600781,
                    "runs": [
                        4681.589061, //<----
                        919.893697,
                        906.600781,
                        857.662655,
                        863.496094
                    ]
                }
            },            

},

The workaround I have for now is to ignore the first result.

0 Answers0