Skip to content

Commit 64e3073

Browse files
Merge pull request #711 from square/sedwards/update-benchmarks-readme
Refactor Perf Poetry to add Related Benchmarks
2 parents 6e511e8 + 3a865d2 commit 64e3073

16 files changed

+58
-42
lines changed

benchmarks/README.md

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1-
# benchmark
1+
# benchmarks
22

33
This module contains benchmarks. Used to measure and help improve Workflow performance. These tests
44
should be run on physical devices.
55

66
## dungeon-benchmark
77

8-
Currently this is the only benchmark included here. It is for the /samples/dungeon/app. This
9-
includes a macrobenchmark [test](benchmarks/dungeon-benchmark/src/main/java/com/squareup/sample/dungeon/benchmark/WorkflowBaselineProfiles.kt)
10-
that exercises this sample app (with UiAutomator) to collect a [baseline profile](https://developer.android.com/studio/profile/baselineprofiles).
11-
After running this the `profile.txt` file can be taken off of the device and used directly in the
12-
/src/main directory of the application. This will include the profile into the APK for guided
13-
optimization at install time.
8+
This is for the /samples/dungeon/app. This includes a macrobenchmark
9+
[test](dungeon-benchmark/src/main/java/com/squareup/sample/dungeon/benchmark/WorkflowBaselineProfiles.kt)
10+
that exercises this sample app (with UiAutomator) to collect
11+
a [baseline profile](https://developer.android.com/studio/profile/baselineprofiles). After running
12+
this the `profile.txt` file can be taken off of the device and used directly in the /src/main
13+
directory of the application. This will include the profile into the APK for guided optimization at
14+
install time.
1415

1516
Better yet, the profile can be split up and added into each Workflow module's src directory so that
1617
it will be included with all APKs built using Workflow (including 3rd party). To do this a java
@@ -28,8 +29,23 @@ This will create an output file separated by module and then also by package as
2829
profile for each module can be added into its /src/main directory as `baseline-prof.txt`. Then on a
2930
release build this will be included with the resulting APK/binary.
3031

31-
The other [test](benchmarks/dungeon-benchmark/src/main/java/com/squareup/sample/dungeon/benchmark/WorkflowBaselineBenchmark.kt)
32+
The other [test](dungeon-benchmark/src/main/java/com/squareup/sample/dungeon/benchmark/WorkflowBaselineBenchmark.kt)
3233
is used to verify the results of including the baseline profiles on the startup time. This runs the
3334
same scenario with and without forcing the use of the profiles. To force the use of profiles, the
3435
`libs.androidx.profileinstaller` dependency is included into the app under profile (dungeon in this
3536
case) for side-loading the profiles.
37+
38+
## performance-poetry
39+
40+
Module of code for performance testing related to poetry applications.
41+
42+
### complex-poetry
43+
44+
This application is a modification of the samples/containers/app-poetry app which uses also the
45+
common components in samples/containers/common and samples/containers/poetry. It modifies this
46+
application to pass the Workflow
47+
a [SimulatedPerfConfig](performance-poetry/complex-poetry/src/main/java/com/squareup/benchmarks/performance/poetry/SimulatedPerfConfig.kt).
48+
49+
In this case we specify that the app should be more 'complex' which adds delays into each of the
50+
selections that are run by Worker's which then trigger a loading state that is handled by the
51+
[MaybeLoadingGatekeeperWorkflow](performance-poetry/complex-poetry/src/main/java/com/squareup/benchmarks/performance/poetry/MaybeLoadingGatekeeperWorkflow.kt).

benchmarks/performancepoetry/build.gradle.kts renamed to benchmarks/performance-poetry/complex-poetry/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ apply(from = rootProject.file(".buildscript/android-ui-tests.gradle"))
88

99
android {
1010
defaultConfig {
11-
applicationId = "com.squareup.benchmarks.performance.poetry"
11+
applicationId = "com.squareup.benchmarks.performance.complex.poetry"
1212
}
1313
}
1414

benchmarks/performancepoetry/src/main/AndroidManifest.xml renamed to benchmarks/performance-poetry/complex-poetry/src/main/AndroidManifest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
33
xmlns:tools="http://schemas.android.com/tools"
4-
package="com.squareup.benchmarks.performance.poetry">
4+
package="com.squareup.benchmarks.performance.complex.poetry">
55

66
<application
77
android:allowBackup="false"
88
android:label="@string/app_name"
99
android:theme="@style/AppTheme"
1010
tools:ignore="AllowBackup,GoogleAppIndexingWarning,MissingApplicationIcon">
1111
<activity
12-
android:name=".PerformancePoetryActivity"
12+
android:name="com.squareup.benchmarks.performance.complex.poetry.PerformancePoetryActivity"
1313
android:exported="true">
1414
<intent-filter>
1515
<action android:name="android.intent.action.MAIN" />

benchmarks/performancepoetry/src/main/java/com/squareup/benchmarks/performance/poetry/MaybeLoadingGatekeeperWorkflow.kt renamed to benchmarks/performance-poetry/complex-poetry/src/main/java/com/squareup/benchmarks/performance/complex/poetry/MaybeLoadingGatekeeperWorkflow.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
package com.squareup.benchmarks.performance.poetry
1+
package com.squareup.benchmarks.performance.complex.poetry
22

3-
import com.squareup.benchmarks.performance.poetry.views.LoaderSpinner
4-
import com.squareup.benchmarks.performance.poetry.views.MayBeLoadingScreen
3+
import com.squareup.benchmarks.performance.complex.poetry.views.LoaderSpinner
4+
import com.squareup.benchmarks.performance.complex.poetry.views.MayBeLoadingScreen
55
import com.squareup.sample.container.overviewdetail.OverviewDetailScreen
66
import com.squareup.workflow1.Snapshot
77
import com.squareup.workflow1.StatefulWorkflow

benchmarks/performancepoetry/src/main/java/com/squareup/benchmarks/performance/poetry/PerformancePoemWorkflow.kt renamed to benchmarks/performance-poetry/complex-poetry/src/main/java/com/squareup/benchmarks/performance/complex/poetry/PerformancePoemWorkflow.kt

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
package com.squareup.benchmarks.performance.poetry
2-
3-
import com.squareup.benchmarks.performance.poetry.PerformancePoemWorkflow.Action.ClearSelection
4-
import com.squareup.benchmarks.performance.poetry.PerformancePoemWorkflow.Action.HandleStanzaListOutput
5-
import com.squareup.benchmarks.performance.poetry.PerformancePoemWorkflow.Action.SelectNext
6-
import com.squareup.benchmarks.performance.poetry.PerformancePoemWorkflow.Action.SelectPrevious
7-
import com.squareup.benchmarks.performance.poetry.PerformancePoemWorkflow.State
8-
import com.squareup.benchmarks.performance.poetry.PerformancePoemWorkflow.State.ComplexCall
9-
import com.squareup.benchmarks.performance.poetry.PerformancePoemWorkflow.State.Initializing
10-
import com.squareup.benchmarks.performance.poetry.PerformancePoemWorkflow.State.Selected
11-
import com.squareup.benchmarks.performance.poetry.views.BlankScreen
1+
package com.squareup.benchmarks.performance.complex.poetry
2+
3+
import com.squareup.benchmarks.performance.complex.poetry.PerformancePoemWorkflow.Action.ClearSelection
4+
import com.squareup.benchmarks.performance.complex.poetry.PerformancePoemWorkflow.Action.HandleStanzaListOutput
5+
import com.squareup.benchmarks.performance.complex.poetry.PerformancePoemWorkflow.Action.SelectNext
6+
import com.squareup.benchmarks.performance.complex.poetry.PerformancePoemWorkflow.Action.SelectPrevious
7+
import com.squareup.benchmarks.performance.complex.poetry.PerformancePoemWorkflow.State
8+
import com.squareup.benchmarks.performance.complex.poetry.PerformancePoemWorkflow.State.ComplexCall
9+
import com.squareup.benchmarks.performance.complex.poetry.PerformancePoemWorkflow.State.Initializing
10+
import com.squareup.benchmarks.performance.complex.poetry.PerformancePoemWorkflow.State.Selected
11+
import com.squareup.benchmarks.performance.complex.poetry.views.BlankScreen
1212
import com.squareup.sample.container.overviewdetail.OverviewDetailScreen
1313
import com.squareup.sample.poetry.PoemWorkflow
1414
import com.squareup.sample.poetry.PoemWorkflow.ClosePoem

benchmarks/performancepoetry/src/main/java/com/squareup/benchmarks/performance/poetry/PerformancePoemsBrowserWorkflow.kt renamed to benchmarks/performance-poetry/complex-poetry/src/main/java/com/squareup/benchmarks/performance/complex/poetry/PerformancePoemsBrowserWorkflow.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
package com.squareup.benchmarks.performance.poetry
1+
package com.squareup.benchmarks.performance.complex.poetry
22

3-
import com.squareup.benchmarks.performance.poetry.PerformancePoemsBrowserWorkflow.State
4-
import com.squareup.benchmarks.performance.poetry.PerformancePoemsBrowserWorkflow.State.ComplexCall
5-
import com.squareup.benchmarks.performance.poetry.PerformancePoemsBrowserWorkflow.State.Initializing
6-
import com.squareup.benchmarks.performance.poetry.PerformancePoemsBrowserWorkflow.State.NoSelection
7-
import com.squareup.benchmarks.performance.poetry.PerformancePoemsBrowserWorkflow.State.Selected
8-
import com.squareup.benchmarks.performance.poetry.views.BlankScreen
3+
import com.squareup.benchmarks.performance.complex.poetry.PerformancePoemsBrowserWorkflow.State
4+
import com.squareup.benchmarks.performance.complex.poetry.PerformancePoemsBrowserWorkflow.State.ComplexCall
5+
import com.squareup.benchmarks.performance.complex.poetry.PerformancePoemsBrowserWorkflow.State.Initializing
6+
import com.squareup.benchmarks.performance.complex.poetry.PerformancePoemsBrowserWorkflow.State.NoSelection
7+
import com.squareup.benchmarks.performance.complex.poetry.PerformancePoemsBrowserWorkflow.State.Selected
8+
import com.squareup.benchmarks.performance.complex.poetry.views.BlankScreen
99
import com.squareup.sample.container.overviewdetail.OverviewDetailScreen
1010
import com.squareup.sample.poetry.PoemListRendering.Companion.NO_POEM_SELECTED
1111
import com.squareup.sample.poetry.PoemListWorkflow

benchmarks/performancepoetry/src/main/java/com/squareup/benchmarks/performance/poetry/PerformancePoetryActivity.kt renamed to benchmarks/performance-poetry/complex-poetry/src/main/java/com/squareup/benchmarks/performance/complex/poetry/PerformancePoetryActivity.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.squareup.benchmarks.performance.poetry
1+
package com.squareup.benchmarks.performance.complex.poetry
22

33
import android.os.Bundle
44
import androidx.activity.viewModels
@@ -8,7 +8,7 @@ import androidx.lifecycle.SavedStateHandle
88
import androidx.lifecycle.ViewModel
99
import androidx.lifecycle.viewModelScope
1010
import androidx.savedstate.SavedStateRegistryOwner
11-
import com.squareup.benchmarks.performance.poetry.views.LoaderContainer
11+
import com.squareup.benchmarks.performance.complex.poetry.views.LoaderContainer
1212
import com.squareup.sample.container.SampleContainers
1313
import com.squareup.sample.poetry.model.Poem
1414
import com.squareup.workflow1.ui.WorkflowLayout

benchmarks/performancepoetry/src/main/java/com/squareup/benchmarks/performance/poetry/PerformancePoetryComponent.kt renamed to benchmarks/performance-poetry/complex-poetry/src/main/java/com/squareup/benchmarks/performance/complex/poetry/PerformancePoetryComponent.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.squareup.benchmarks.performance.poetry
1+
package com.squareup.benchmarks.performance.complex.poetry
22

33
import androidx.appcompat.app.AppCompatActivity
44
import androidx.lifecycle.ViewModel

benchmarks/performancepoetry/src/main/java/com/squareup/benchmarks/performance/poetry/SimulatedPerfConfig.kt renamed to benchmarks/performance-poetry/complex-poetry/src/main/java/com/squareup/benchmarks/performance/complex/poetry/SimulatedPerfConfig.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.squareup.benchmarks.performance.poetry
1+
package com.squareup.benchmarks.performance.complex.poetry
22

33
/**
44
* We use this to 'simulate' different performance scenarios that we have seen that we want to

benchmarks/performancepoetry/src/main/java/com/squareup/benchmarks/performance/poetry/views/BlankScreen.kt renamed to benchmarks/performance-poetry/complex-poetry/src/main/java/com/squareup/benchmarks/performance/complex/poetry/views/BlankScreen.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.squareup.benchmarks.performance.poetry.views
1+
package com.squareup.benchmarks.performance.complex.poetry.views
22

33
import android.content.Context
44
import android.view.ViewGroup

0 commit comments

Comments
 (0)