Skip to content

Conversation

@not-matthias
Copy link
Member

@not-matthias not-matthias commented Jan 16, 2026

  • fix(go-runner): limit maximum b.Loop() execution time
  • refactor(go-runner): move shared logic to external file
  • fix(go-runner): limit maximum b.N benchmark time

Sets a maximum time for the benchmark execution, and exits early if we exceed it. Currently this is set to 3 * benchTime (so 9s in our case)

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses performance issues with CodSpeed's Go benchmark runner by implementing safeguards to prevent benchmarks from running excessively long. The changes add timeout limits for both b.Loop() and b.N benchmark execution patterns.

Changes:

  • Added maximum execution time limits (2x the benchmark time) to prevent runaway benchmarks
  • Refactored duplicate warmup logic into a shared runBenchmarkWithWarmup function
  • Modified b.Loop() to track overhead from timer start/stop operations

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
go-runner/overlay/codspeed.go Adds BenchMaxTimeMult constant, stopOrScaleBLoopCodspeed() method for loop time limiting, and runBenchmarkWithWarmup() function containing shared benchmark execution logic
go-runner/overlay/benchmark1.25.0.go Refactors inline warmup code to use shared runBenchmarkWithWarmup() function, initializes loopStartTime, and switches to stopOrScaleBLoopCodspeed()
go-runner/overlay/benchmark1.24.0.go Identical changes to benchmark1.25.0.go for Go 1.24.0 compatibility

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codspeed-hq
Copy link

codspeed-hq bot commented Jan 16, 2026

CodSpeed Performance Report

Merging this PR will not alter performance

Comparing cod-2004-codspeed-go-bloop-benchmarks-are-too-slow (6940d07) with main (59c0bda)

Summary

✅ 48 untouched benchmarks
⏩ 1 skipped benchmark1

Footnotes

  1. 1 benchmark was skipped, so the baseline result was used instead. If it was deleted from the codebase, click here and archive it to remove it from the performance reports.

@not-matthias not-matthias force-pushed the cod-2004-codspeed-go-bloop-benchmarks-are-too-slow branch 2 times, most recently from 3eddbb4 to f8b8d75 Compare January 16, 2026 15:30
@not-matthias not-matthias requested a review from Copilot January 16, 2026 15:33
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@not-matthias not-matthias force-pushed the cod-2004-codspeed-go-bloop-benchmarks-are-too-slow branch from 4f8bc49 to 6940d07 Compare January 16, 2026 15:39
@not-matthias not-matthias changed the title cod 2004 codspeed go bloop benchmarks are too slow fix: b.loop benchmarks are too slow Jan 16, 2026
@not-matthias not-matthias changed the title fix: b.loop benchmarks are too slow fix: benchmarks timeout Jan 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants