Unified · Split
| @@ -20,6 +20,7 @@ type BenchmarkSweepToggleEnv = { · 19 unmodified lines | ||
| 20 | 20 | |
| 21 | 21 | const TRUE_VALUES = new Set(["1", "true", "yes", "on"]); |
| 22 | 22 | const FALSE_VALUES = new Set(["0", "false", "no", "off"]); |
| 23 | +// Avoid pathological workload from misconfigured env overrides in CI. | |
| 23 | 24 | const MAX_BENCHMARK_FOLLOW_UP_PASSES = 5; |
| 24 | 25 | |
| 25 | 26 | function parseBooleanLike(value: string | undefined): boolean | null { |
| @@ -59,10 +60,20 @@ export function shouldRunOptionalRendererPerfInteractions(env: OptionalRendererT · 33 unmodified lines | ||
| 59 | 60 | return resolveBooleanToggle(env.T3CODE_DESKTOP_PERF_RUN_OPTIONAL_RENDERER, env.CI); |
| 60 | 61 | } |
| 61 | 62 | |
| 63 | +/** | |
| 64 | + * Controls high-variance benchmark thread switching loops. | |
| 65 | + * Defaults off in CI, on locally, with explicit env override support. | |
| 66 | + */ | |
| 62 | 67 | export function shouldRunBenchmarkThreadSweep(env: BenchmarkSweepToggleEnv): boolean { |
| 63 | 68 | return resolveBooleanToggle(env.T3CODE_DESKTOP_PERF_RUN_BENCHMARK_SWEEP, env.CI); |
| 64 | 69 | } |
| 65 | 70 | |
| 71 | +/** | |
| 72 | + * Resolves number of follow-up benchmark passes. | |
| 73 | + * - explicit non-negative integer env override wins | |
| 74 | + * - value is capped for safety | |
| 75 | + * - otherwise defaults to 0 in CI and 1 locally | |
| 76 | + */ | |
| 66 | 77 | export function resolveBenchmarkFollowUpPassCount(env: PerfBenchmarkEnv): number { |
| 67 | 78 | const raw = env.T3CODE_DESKTOP_PERF_BENCHMARK_FOLLOW_UP_PASSES?.trim(); |
| 68 | 79 | if (raw && /^\d+$/.test(raw)) { |