From 4535b82483370b09d7e168f234ed995634f85684 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Thu, 2 Apr 2026 11:51:52 -1000 Subject: [PATCH] [scheduler] Remove redundant Defer_UniqueID, keep anonymous + same-ID MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit UniqueID benchmark was unrealistic — unique IDs still ran cancel_item_locked_ scanning all containers for matches that never exist. Replace with just two meaningful defer variants: - Defer: anonymous (nullptr name, skips cancel entirely) - Defer_SameID: fixed ID (cancel-and-replace coalescing pattern) --- tests/benchmarks/core/bench_scheduler.cpp | 27 ----------------------- 1 file changed, 27 deletions(-) diff --git a/tests/benchmarks/core/bench_scheduler.cpp b/tests/benchmarks/core/bench_scheduler.cpp index 65daa02c15c..214fe0e4b87 100644 --- a/tests/benchmarks/core/bench_scheduler.cpp +++ b/tests/benchmarks/core/bench_scheduler.cpp @@ -203,33 +203,6 @@ static void Scheduler_Defer_SameID(benchmark::State &state) { } BENCHMARK(Scheduler_Defer_SameID); -// --- Scheduler: defer with unique IDs (no cancel path) --- - -static void Scheduler_Defer_UniqueID(benchmark::State &state) { - Scheduler scheduler; - Component dummy_component; - - // Measures defer with unique numeric IDs — cancel_item_locked_ runs but - // never finds a match, measuring the scan overhead on an empty search. - static constexpr int kBatchSize = 3; - static_assert(kInnerIterations % kBatchSize == 0, "kInnerIterations must be divisible by kBatchSize"); - warm_pool(scheduler, &dummy_component, kBatchSize, 0); - for (auto _ : state) { - uint32_t now = millis(); - uint32_t id = 0; - for (int i = 0; i < kInnerIterations; i++) { - scheduler.set_timeout(&dummy_component, id++, 0, []() {}); - if ((i + 1) % kBatchSize == 0) { - scheduler.call(++now); - } - } - scheduler.call(++now); - benchmark::DoNotOptimize(scheduler); - } - state.SetItemsProcessed(state.iterations() * kInnerIterations); -} -BENCHMARK(Scheduler_Defer_UniqueID); - // --- Scheduler: set_timeout with batch size exceeding pool (cliff test) --- static void Scheduler_SetTimeout_ExceedPool(benchmark::State &state) {