Skip to content

Commit 96997a2

Browse files
Merge pull request #1365 from square/zachklipp/dispatcher-runtime
Use WorkStealingDispatcher in runtime, behind a flag.
2 parents 7deeba3 + d9bbcff commit 96997a2

File tree

10 files changed

+678
-99
lines changed

10 files changed

+678
-99
lines changed

.github/workflows/kotlin.yml

Lines changed: 37 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ jobs:
239239
uses: mikepenz/action-junit-report@5f47764eec0e1c1f19f40c8e60a5ba47e47015c5 # v4
240240
if: always() # always run even if the previous step fails
241241
with:
242-
report_paths: '**/build/test-results/test/TEST-*.xml'
242+
report_paths: '**/build/test-results/jvmTest/TEST-*.xml'
243243

244244
jvm-conflate-runtime-test:
245245
name: CSR JVM Tests
@@ -260,7 +260,7 @@ jobs:
260260
uses: mikepenz/action-junit-report@5f47764eec0e1c1f19f40c8e60a5ba47e47015c5 # v4
261261
if: always() # always run even if the previous step fails
262262
with:
263-
report_paths: '**/build/test-results/test/TEST-*.xml'
263+
report_paths: '**/build/test-results/jvmTest/TEST-*.xml'
264264

265265
jvm-stateChange-runtime-test:
266266
name: SCO JVM Tests
@@ -281,7 +281,7 @@ jobs:
281281
uses: mikepenz/action-junit-report@5f47764eec0e1c1f19f40c8e60a5ba47e47015c5 # v4
282282
if: always() # always run even if the previous step fails
283283
with:
284-
report_paths: '**/build/test-results/test/TEST-*.xml'
284+
report_paths: '**/build/test-results/jvmTest/TEST-*.xml'
285285

286286
jvm-stable-handlers-test:
287287
name: SEH JVM Tests
@@ -302,7 +302,7 @@ jobs:
302302
uses: mikepenz/action-junit-report@5f47764eec0e1c1f19f40c8e60a5ba47e47015c5 # v4
303303
if: always() # always run even if the previous step fails
304304
with:
305-
report_paths: '**/build/test-results/test/TEST-*.xml'
305+
report_paths: '**/build/test-results/jvmTest/TEST-*.xml'
306306

307307
jvm-partial-runtime-test:
308308
name: PTR JVM Tests
@@ -323,7 +323,7 @@ jobs:
323323
uses: mikepenz/action-junit-report@5f47764eec0e1c1f19f40c8e60a5ba47e47015c5 # v4
324324
if: always() # always run even if the previous step fails
325325
with:
326-
report_paths: '**/build/test-results/test/TEST-*.xml'
326+
report_paths: '**/build/test-results/jvmTest/TEST-*.xml'
327327

328328
jvm-conflate-stateChange-runtime-test:
329329
name: SCO, CSR JVM Tests
@@ -344,7 +344,7 @@ jobs:
344344
uses: mikepenz/action-junit-report@5f47764eec0e1c1f19f40c8e60a5ba47e47015c5 # v4
345345
if: always() # always run even if the previous step fails
346346
with:
347-
report_paths: '**/build/test-results/test/TEST-*.xml'
347+
report_paths: '**/build/test-results/jvmTest/TEST-*.xml'
348348

349349
jvm-conflate-partial-runtime-test:
350350
name: CSR, PTR JVM Tests
@@ -365,7 +365,7 @@ jobs:
365365
uses: mikepenz/action-junit-report@5f47764eec0e1c1f19f40c8e60a5ba47e47015c5 # v4
366366
if: always() # always run even if the previous step fails
367367
with:
368-
report_paths: '**/build/test-results/test/TEST-*.xml'
368+
report_paths: '**/build/test-results/jvmTest/TEST-*.xml'
369369

370370
jvm-conflate-drainExclusive-runtime-test:
371371
name: CSR, DEA JVM Tests
@@ -386,7 +386,7 @@ jobs:
386386
uses: mikepenz/action-junit-report@5f47764eec0e1c1f19f40c8e60a5ba47e47015c5 # v4
387387
if: always() # always run even if the previous step fails
388388
with:
389-
report_paths: '**/build/test-results/test/TEST-*.xml'
389+
report_paths: '**/build/test-results/jvmTest/TEST-*.xml'
390390

391391
jvm-stateChange-drainExclusive-runtime-test:
392392
name: SCO, DEA JVM Tests
@@ -407,7 +407,7 @@ jobs:
407407
uses: mikepenz/action-junit-report@5f47764eec0e1c1f19f40c8e60a5ba47e47015c5 # v4
408408
if: always() # always run even if the previous step fails
409409
with:
410-
report_paths: '**/build/test-results/test/TEST-*.xml'
410+
report_paths: '**/build/test-results/jvmTest/TEST-*.xml'
411411

412412
jvm-partial-drainExclusive-runtime-test:
413413
name: PTR, DEA JVM Tests
@@ -428,7 +428,7 @@ jobs:
428428
uses: mikepenz/action-junit-report@5f47764eec0e1c1f19f40c8e60a5ba47e47015c5 # v4
429429
if: always() # always run even if the previous step fails
430430
with:
431-
report_paths: '**/build/test-results/test/TEST-*.xml'
431+
report_paths: '**/build/test-results/jvmTest/TEST-*.xml'
432432

433433
jvm-conflate-stateChange-drainExclusive-runtime-test:
434434
name: SCO, CSR, DEA JVM Tests
@@ -449,7 +449,7 @@ jobs:
449449
uses: mikepenz/action-junit-report@5f47764eec0e1c1f19f40c8e60a5ba47e47015c5 # v4
450450
if: always() # always run even if the previous step fails
451451
with:
452-
report_paths: '**/build/test-results/test/TEST-*.xml'
452+
report_paths: '**/build/test-results/jvmTest/TEST-*.xml'
453453

454454
jvm-conflate-partial-drainExclusive-runtime-test:
455455
name: CSR, PTR, DEA JVM Tests
@@ -470,7 +470,28 @@ jobs:
470470
uses: mikepenz/action-junit-report@5f47764eec0e1c1f19f40c8e60a5ba47e47015c5 # v4
471471
if: always() # always run even if the previous step fails
472472
with:
473-
report_paths: '**/build/test-results/test/TEST-*.xml'
473+
report_paths: '**/build/test-results/jvmTest/TEST-*.xml'
474+
475+
jvm-all-runtime-test:
476+
name: ALL Optimizations JVM Tests
477+
runs-on: ubuntu-latest
478+
timeout-minutes: 20
479+
steps:
480+
- name: Checkout
481+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
482+
483+
- name: Check with Gradle
484+
uses: ./.github/actions/gradle-task
485+
with:
486+
task: jvmTest --continue -Pworkflow.runtime=all
487+
restore-cache-key: main-build-artifacts
488+
489+
# Report as GitHub Pull Request Check.
490+
- name: Publish Test Report
491+
uses: mikepenz/action-junit-report@5f47764eec0e1c1f19f40c8e60a5ba47e47015c5 # v4
492+
if: always() # always run even if the previous step fails
493+
with:
494+
report_paths: '**/build/test-results/jvmTest/TEST-*.xml'
474495

475496
ios-tests:
476497
name: iOS Tests
@@ -491,7 +512,7 @@ jobs:
491512
uses: mikepenz/action-junit-report@5f47764eec0e1c1f19f40c8e60a5ba47e47015c5 # v4
492513
if: always() # always run even if the previous step fails
493514
with:
494-
report_paths: '**/build/test-results/test/TEST-*.xml'
515+
report_paths: '**/build/test-results/iosX64Test/TEST-*.xml'
495516

496517
js-tests:
497518
name: JS Tests
@@ -513,7 +534,7 @@ jobs:
513534
uses: mikepenz/action-junit-report@5f47764eec0e1c1f19f40c8e60a5ba47e47015c5 # v4
514535
if: always() # always run even if the previous step fails
515536
with:
516-
report_paths: '**/build/test-results/test/TEST-*.xml'
537+
report_paths: '**/build/test-results/jsTest/TEST-*.xml'
517538

518539
performance-tests:
519540
name: Performance tests
@@ -578,7 +599,7 @@ jobs:
578599
### <start-connected-check-shards>
579600
shardNum: [ 1, 2, 3 ]
580601
### <end-connected-check-shards>
581-
runtime: [ conflate, stateChange, drainExclusive, conflate-stateChange, partial, conflate-partial, stable, conflate-drainExclusive, stateChange-drainExclusive, partial-drainExclusive, conflate-partial-drainExclusive ]
602+
runtime: [ conflate, stateChange, drainExclusive, conflate-stateChange, partial, conflate-partial, stable, conflate-drainExclusive, stateChange-drainExclusive, partial-drainExclusive, conflate-partial-drainExclusive, all ]
582603
steps:
583604
- name: Checkout
584605
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
@@ -618,6 +639,7 @@ jobs:
618639
- jvm-partial-drainExclusive-runtime-test
619640
- jvm-conflate-stateChange-drainExclusive-runtime-test
620641
- jvm-conflate-partial-drainExclusive-runtime-test
642+
- jvm-all-runtime-test
621643
- ktlint
622644
- performance-tests
623645
- runtime-instrumentation-tests

workflow-config/config-android/src/main/java/com/squareup/workflow1/config/AndroidRuntimeConfigTools.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import com.squareup.workflow1.RuntimeConfigOptions.DRAIN_EXCLUSIVE_ACTIONS
77
import com.squareup.workflow1.RuntimeConfigOptions.PARTIAL_TREE_RENDERING
88
import com.squareup.workflow1.RuntimeConfigOptions.RENDER_ONLY_WHEN_STATE_CHANGES
99
import com.squareup.workflow1.RuntimeConfigOptions.STABLE_EVENT_HANDLERS
10+
import com.squareup.workflow1.RuntimeConfigOptions.WORK_STEALING_DISPATCHER
1011
import com.squareup.workflow1.WorkflowExperimentalRuntime
1112

1213
public class AndroidRuntimeConfigTools {
@@ -38,6 +39,11 @@ public class AndroidRuntimeConfigTools {
3839
* - `drainExclusive` Enables draining exclusive actions. If we have more actions to process
3940
* that are queued on nodes not affected by the last action application, then we will
4041
* continue to process those actions before another render pass.
42+
*
43+
* - `stealingDispatcher` Enables turning on the [WorkStealingDispatcher] to try and drain
44+
* available tasks.
45+
*
46+
* - `all` Enables all optimizations.
4147
*/
4248
@WorkflowExperimentalRuntime
4349
public fun getAppWorkflowRuntimeConfig(): RuntimeConfig {
@@ -54,6 +60,8 @@ public class AndroidRuntimeConfigTools {
5460
"partial" -> config.addAll(setOf(RENDER_ONLY_WHEN_STATE_CHANGES, PARTIAL_TREE_RENDERING))
5561
"stable" -> config.add(STABLE_EVENT_HANDLERS)
5662
"drainExclusive" -> config.add(DRAIN_EXCLUSIVE_ACTIONS)
63+
"stealingDispatcher" -> config.add(WORK_STEALING_DISPATCHER)
64+
"all" -> config.addAll(RuntimeConfigOptions.ALL)
5765
else -> throw IllegalArgumentException("Unrecognized runtime config option \"$it\"")
5866
}
5967
}

workflow-config/config-jvm/src/main/java/com/squareup/workflow1/config/JvmTestRuntimeConfigTools.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import com.squareup.workflow1.RuntimeConfigOptions.DRAIN_EXCLUSIVE_ACTIONS
77
import com.squareup.workflow1.RuntimeConfigOptions.PARTIAL_TREE_RENDERING
88
import com.squareup.workflow1.RuntimeConfigOptions.RENDER_ONLY_WHEN_STATE_CHANGES
99
import com.squareup.workflow1.RuntimeConfigOptions.STABLE_EVENT_HANDLERS
10+
import com.squareup.workflow1.RuntimeConfigOptions.WORK_STEALING_DISPATCHER
1011
import com.squareup.workflow1.WorkflowExperimentalRuntime
1112

1213
public class JvmTestRuntimeConfigTools {
@@ -40,6 +41,11 @@ public class JvmTestRuntimeConfigTools {
4041
* - `drainExclusive` Enables draining exclusive actions. If we have more actions to process
4142
* that are queued on nodes not affected by the last action application, then we will
4243
* continue to process those actions before another render pass.
44+
*
45+
* - `stealingDispatcher` Enables turning on the [WorkStealingDispatcher] to try and drain
46+
* available tasks.
47+
*
48+
* - `all` Enables all optimizations.
4349
*/
4450
@OptIn(WorkflowExperimentalRuntime::class)
4551
public fun getTestRuntimeConfig(): RuntimeConfig {
@@ -56,6 +62,8 @@ public class JvmTestRuntimeConfigTools {
5662
"partial" -> config.addAll(setOf(RENDER_ONLY_WHEN_STATE_CHANGES, PARTIAL_TREE_RENDERING))
5763
"stable" -> config.add(STABLE_EVENT_HANDLERS)
5864
"drainExclusive" -> config.add(DRAIN_EXCLUSIVE_ACTIONS)
65+
"stealingDispatcher" -> config.add(WORK_STEALING_DISPATCHER)
66+
"all" -> config.addAll(RuntimeConfigOptions.ALL)
5967
else -> throw IllegalArgumentException("Unrecognized runtime config option \"$it\"")
6068
}
6169
}

0 commit comments

Comments
 (0)