Skip to content

perf(runtime): skip foreground slice timing when no foreground work is runnable #37

Open

Description

@thweetkomputer

Follow-up to #33 (worker-owned shared-ring progression and sleep coordination). This is a source-based optimization opportunity, not a measured performance result.

Current behavior

Worker::RunOnce() reads CycleNow before and after DrainReadyUntil even when both foreground ready and remote-work queues are empty. Such rounds perform empty dispatch and timing calculations with a zero resume count. Empty polling and waiting for SPDK completions are candidate workloads.

Proposed work

After completion polling and deferred-queue merging, bypass the foreground slice when no foreground work is runnable. Preserve foreground/background admission and runtime accounting. Consider the cost of the added busy-path branch; do not assume fewer source statements mean fewer release instructions.

Checking deadlines less frequently inside a nonempty drain is outside this initial change: it alters cooperative scheduling overrun and tail-latency bounds.

Acceptance

  • Inspect optimized code and measure empty-round instructions/cycles and clock reads before/after.
  • Benchmark empty polling, SPDK-outstanding rounds, and saturated short foreground tasks to detect branch-related regressions.
  • Test work made runnable by completion polling, deferred continuations, remote foreground work, and background-only scheduling.
  • Preserve scheduler statistics definitions, foreground/background budgets and fairness; document any intentional accounting change.
  • Retain only if the empty-round saving does not cause an unacceptable busy-path regression.

Benchmark reports should identify the tested revision/build and compare instructions, cycles, throughput, and p99 latency where relevant. Record only non-default settings after checking the tested version's defaults. Preserve notification preparation/recheck/cleanup, mailbox wake_seq, DPDK parked handshakes, and pending-I/O sleep vetoes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions