From ed203dde5d7de66673c50376a9997f8cd9ce8539 Mon Sep 17 00:00:00 2001 From: CPunisher <1343316114@qq.com> Date: Fri, 16 Jan 2026 16:20:45 +0800 Subject: [PATCH] Limit threads --- .github/actions/codspeed/action.yaml | 102 --------------------- .github/workflows/reusable-build-bench.yml | 5 +- xtask/benchmark/benches/groups/bundle.rs | 3 +- 3 files changed, 6 insertions(+), 104 deletions(-) delete mode 100644 .github/actions/codspeed/action.yaml diff --git a/.github/actions/codspeed/action.yaml b/.github/actions/codspeed/action.yaml deleted file mode 100644 index ee667c8a06ff..000000000000 --- a/.github/actions/codspeed/action.yaml +++ /dev/null @@ -1,102 +0,0 @@ -name: 'CodSpeed Performance Analysis' -description: 'Continuous benchmarking and performance checks' -branding: - color: orange - icon: activity - -author: 'Arthur Pastel' -inputs: - token: - description: 'CodSpeed upload token' - required: false - run: - description: 'The command to run the benchmarks' - required: true - - working-directory: - description: | - The directory where the `run` command will be executed. - Warning: if you use defaults.working-directory, you must still set this parameter. - required: false - upload-url: - description: 'The upload endpoint (for on-premise deployments)' - required: false - - runner-version: - description: 'The version of the runner to use' - required: false - - mode: - description: | - The mode to to run the benchmarks in. The following modes are available: - - `instrumentation` (default): Run the benchmarks with instrumentation enabled. - - `walltime`: Run the benchmarks with walltime enabled. - - We strongly recommend not changing this mode unless you know what you are doing. - - Using the `walltime` mode on traditional VMs/Hosted Runners will lead to inconsistent data. For the best results, we recommend using CodSpeed Hosted Macro Runners, which are fine-tuned for performance measurement consistency. - Check out the [Walltime Instrument Documentation](https://docs.codspeed.io/instruments/walltime/) for more details. - required: false - - instruments: - description: | - Comma separated list of instruments to enable. The following instruments are available: - - `mongodb`: MongoDB instrumentation, requires the MongoDB instrument to be enabled for the organization in CodSpeed - required: false - mongo-uri-env-name: - description: | - The name of the environment variable containing the MongoDB URI. Requires the `mongodb` instrument to be activated in `instruments`. - If the instrumentation is enabled and this value is not set, the user will need to dynamically provide the MongoDB URI to the CodSpeed runner. - required: false - -runs: - using: 'composite' - steps: - - shell: bash - env: - GH_MATRIX: '${{ toJson(matrix) }}' - GH_STRATEGY: '${{ toJson(strategy) }}' - run: | - # Configure and run codspeed-runner - # if [ -n "${{ inputs.runner-version }}" ]; then - # RUNNER_VERSION="${{ inputs.runner-version }}" - # else - # RUNNER_VERSION=$(cat $GITHUB_ACTION_PATH/.codspeed-runner-version) - # fi - - # Get the runner arguments - RUNNER_ARGS="" - if [ -n "${{ inputs.token }}" ]; then - RUNNER_ARGS="$RUNNER_ARGS --token ${{ inputs.token }}" - fi - if [ -n "${{ inputs.working-directory }}" ]; then - RUNNER_ARGS="$RUNNER_ARGS --working-directory=${{ inputs.working-directory }}" - fi - if [ -n "${{ inputs.upload-url }}" ]; then - RUNNER_ARGS="$RUNNER_ARGS --upload-url=${{ inputs.upload-url }}" - fi - if [ -n "${{ inputs.mode }}" ]; then - RUNNER_ARGS="$RUNNER_ARGS --mode=${{ inputs.mode }}" - fi - if [ -n "${{ inputs.instruments }}" ]; then - RUNNER_ARGS="$RUNNER_ARGS --instruments=${{ inputs.instruments }}" - fi - if [ -n "${{ inputs.mongo-uri-env-name }}" ]; then - RUNNER_ARGS="$RUNNER_ARGS --mongo-uri-env-name=${{ inputs.mongo-uri-env-name }}" - fi - - # Install the CodSpeedHQ/runner - # head_status=$(curl -I -fsSL -w "%{http_code}" -o /dev/null https://github.com/CodSpeedHQ/runner/releases/download/v$RUNNER_VERSION/codspeed-runner-installer.sh) - # if [ "$head_status" -eq 404 ]; then - # echo "Error: Version $RUNNER_VERSION is not available in https://github.com/CodSpeedHQ/runner/releases, please a correct version." - # exit 1 - # else - # curl -fsSL https://github.com/CodSpeedHQ/runner/releases/download/v$RUNNER_VERSION/codspeed-runner-installer.sh | bash -s -- --quiet - # fi - - # We can use official official runner if it supports config valgrind flags in the future: https://github.com/CodSpeedHQ/runner/pull/92 - cargo install --git https://github.com/CPunisher/runner.git --rev 7e87e3c5d93390fb28e4fbd5f3859f3b20d8fc6a - - # Run the benchmarks - # Enable fair sched to make benchmark more stable, see: https://github.com/CodSpeedHQ/runner/pull/91 - env VALGRIND_FLAGS='--fair-sched=yes' codspeed run $RUNNER_ARGS -- '${{ inputs.run }}' diff --git a/.github/workflows/reusable-build-bench.yml b/.github/workflows/reusable-build-bench.yml index 0fc566686e80..ab82b54560db 100644 --- a/.github/workflows/reusable-build-bench.yml +++ b/.github/workflows/reusable-build-bench.yml @@ -77,8 +77,11 @@ jobs: run: pnpm run build:js - name: Run benchmark - uses: ./.github/actions/codspeed + uses: CodSpeedHQ/action@0700edb451d0e9f2426f99bd6977027e550fb2a6 # https://github.com/CodSpeedHQ/action/releases/tag/v4.7.0 timeout-minutes: 30 + env: + RAYON_NUM_THREADS: 1 with: + mode: 'simulation' run: pnpm run bench:ci token: ${{ secrets.CODSPEED_TOKEN }} diff --git a/xtask/benchmark/benches/groups/bundle.rs b/xtask/benchmark/benches/groups/bundle.rs index 56ad7a5c5f09..37f9a00229db 100644 --- a/xtask/benchmark/benches/groups/bundle.rs +++ b/xtask/benchmark/benches/groups/bundle.rs @@ -22,7 +22,8 @@ fn bundle_benchmark(c: &mut Criterion) { // Codspeed can only handle to up to 500 threads by default let rt = runtime::Builder::new_multi_thread() - .max_blocking_threads(256) + .worker_threads(8) + .max_blocking_threads(8) .build() .unwrap();