Skip to content

[Repo Assist] perf/ci: add NuGet caching and reduce test delays #294

@github-actions

Description

@github-actions

🤖 This is an automated PR from Repo Assist, triggered by a /repo-assist comment on #290.


Two categories of improvements to reduce CI time, addressing #290.

CI: NuGet Package Caching

Adds actions/cache@v4 to cache ~/.nuget/packages in test.yaml, build.yaml, and main.yaml. The cache key is hashed from all .fsproj/.csproj files and global.json, with a fallback restore key. On a cache hit, dotnet restore skips downloading packages entirely.

Expected savings: ~30–90 seconds per job depending on package sizes and network conditions (4 jobs per PR run benefit from this).

Tests: Reduced Artificial Delays

Several test helpers used large artificial delays that multiply across hundreds of theory test cases:

Location Old New Impact
DummyTaskFactory default 10–30 ms/task 1–5 ms/task affects all direct uses
Gen.sideEffectTaskSeq 10–30 ms/task 1–5 ms/task 14 call sites in CE tests
AsyncYielded / AsyncYielded_Nested theory variants 15–50 ms × 10 tasks = 150–500 ms per case 1–5 ms × 10 tasks = 10–50 ms per case ~68 theory test cases
longDelay() random 20–70 ms Task.Delay(1) ≈ 15 ms on Windows 3 empty-sequence variants × 119 tests
IsEmpty slow fact 200–400 ms × 3 tasks 1–5 ms × 3 tasks 1 test, was ~900 ms
ExactlyOne slow facts 50–300 ms × 1 task (×2) 1–5 ms × 1 task 2 tests, were ~175 ms each

Expected savings: roughly 20–40 seconds of test execution time per job.

Why this is safe

  • The async yield point (Task.Delay 0 inside delayTask, real timer in longDelay) is preserved — tests still exercise genuine async suspension paths.
  • The AsyncYielded variants switch from Task.Delay-based waits (≥15 ms each) to spinWait (1–5 ms). Since delayTask unconditionally does let! _ = Task.Delay 0 first, each task still suspends asynchronously before the spinwait, preserving the interleaving semantics under test.
  • sideEffectTaskSeq ordering tests rely on sequential enumeration (not on timing), so shorter delays don't affect correctness.

Test Status

Build and test cannot be run in this environment (SDK 10.0.103 not available locally). The CI on this PR will validate correctness. Workflow file changes are syntactically validated manually.

Generated by Repo Assist for issue #290 ·

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@ec7d342403c9912c87320110f8822a8fbb817a0c

Note

This was originally intended as a pull request, but the git push operation failed.

Workflow Run: View run details and download patch artifact

The patch file is available in the agent-artifacts artifact in the workflow run linked above.

To create a pull request with the changes:

# Download the artifact from the workflow run
gh run download 22806660407 -n agent-artifacts -D /tmp/agent-artifacts-22806660407

# Create a new branch
git checkout -b repo-assist/ci-test-perf-2026-03-647061314c105ab1

# Apply the patch (--3way handles cross-repo patches where files may already exist)
git am --3way /tmp/agent-artifacts-22806660407/aw-repo-assist-ci-test-perf-2026-03.patch

# Push the branch to origin
git push origin repo-assist/ci-test-perf-2026-03-647061314c105ab1

# Create the pull request
gh pr create --title '[Repo Assist] perf/ci: add NuGet caching and reduce test delays' --base main --head repo-assist/ci-test-perf-2026-03-647061314c105ab1 --repo fsprojects/FSharp.Control.TaskSeq
Show patch preview (246 of 246 lines)
From 8d60f090828683aaf65fbf611a483f079467f86f Mon Sep 17 00:00:00 2001
From: Repo Assist <repo-assist@github.com>
Date: Sat, 7 Mar 2026 20:39:40 +0000
Subject: [PATCH] perf/ci: add NuGet caching and reduce test delays

CI improvements:
- Add actions/cache@v4 for NuGet packages to test.yaml, build.yaml,
  and main.yaml. Caches ~/.nuget/packages keyed on project files and
  global.json, with a fallback restore key. This avoids re-downloading
  packages on every CI run.

Test performance improvements:
- Reduce default DummyTaskFactory delay from 10-30ms to 1-5ms
- Reduce Gen.sideEffectTaskSeq default from 10-30ms to 1-5ms
- Reduce AsyncYielded/AsyncYielded_Nested variants from 15-50ms to 1-5ms
  per task (affects 68+ theory test cases that each run 10 sequential tasks)
- Reduce longDelay() from random 20-70ms to Task.Delay(1) (~15ms on Windows)
- Reduce sideEffectTaskSeqMs 200-400ms calls in IsEmpty and ExactlyOne
  tests to sideEffectTaskSeqMicro 1-5ms

The async yield point (Task.Delay 0 inside delayTask, and the real timer
in longDelay) is preserved so tests still verify behaviour with genuine
async suspensions. Only the wall-clock waiting time is reduced.

Closes #290

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
 .github/workflows/build.yaml                  | 15 +++++++++++++
 .github/workflows/main.yaml                   | 14 +++++++++++++
 .github/workflows/test.yaml                   | 16 ++++++++++++++
 .../TaskSeq.ExactlyOne.Tests.fs               |  4 ++--
 .../TaskSeq.IsEmpty.fs                        |  2 +-
 src/FSharp.Control.TaskSeq.Test/TestUtils.fs  | 21 ++++++++++---------
 6 files changed, 59 insertions(+), 13 deletions(-)

diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index b144d80..b149906 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -15,6 +15,13 @@ jobs:
 
       - name: setup-dotnet
         uses: actions/setup-dotnet@v4
+
+      - name: Cache NuGet packag
... (truncated)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions