Skip to content

Performance: drive full aio-websearch toward a 2–3s warm p50 #97

Description

@apmantza

Goal

Drive the full aio-websearch tool toward a measured 2–3 second warm p50 on a healthy Windows development machine, without sacrificing partial-result behavior, success rate, lifecycle safety, or the legacy default contract.

This is an aspirational performance target, not a claim that the current implementation reaches it.

Current evidence

The existing measurements are Google-lane measurements, not full-tool measurements:

Lane Samples Completed p50 p95
Legacy Google, original waits 3 3/3 5.62s 6.33s
Legacy Google, condition-driven waits 10 10/10 3.63s 4.08s
Opt-in broker Google, warm 3 3/3 0.66s 1.01s
Opt-in broker Google, cold 2 2/2 1.06s 1.13s

The broker figures are not full aio-websearch figures. The full tool also fans out to HTTP providers and Reddit, aggregates/deduplicates/ranks results, and renders the final result. We need a new end-to-end baseline before claiming progress.

Definitions

  • Full search: the public aio-websearch tool path with its documented default provider policy, measured from tool execution start until the result is returned.
  • Warm: the dedicated browser/broker infrastructure is already healthy; no Chrome/profile/browser cold start is charged.
  • Cold: browser/broker infrastructure is stopped or unavailable before the sample and startup is charged.
  • Healthy machine: record OS, CPU/RAM, commit charge, Chrome version, Node version, network caveats, and concurrent pi sessions.
  • Success: a valid result with the expected provider/status fields. A partial result is successful if the documented deadline contract is honored and at least one provider returns usable results.

Required work

1. Establish a reproducible full-tool baseline

Add or extend an offline-safe/local benchmark harness that can measure the real tool orchestration with provider fakes, and a separately documented live harness for end-to-end validation. Record:

  • total latency and completion-before-deadline;
  • per-provider latency/status/counts and timeout/error reason;
  • Google legacy/broker phase timings;
  • broker/Chrome startup, target allocation, navigation, extraction, aggregation, ranking, and rendering time;
  • warm versus cold samples;
  • n>=10 per stable variant/query set where live-network politeness permits;
  • process count, private bytes, and Windows commit charge before/after/peak.

Record results in speed.md and link the data from this issue. Do not use a small Google-only sample as evidence for the full target.

2. Remove avoidable orchestration latency

Investigate and measure, rather than assume:

  • whether all providers obey the outer deadline and cancellation signal;
  • whether a slow Google/Reddit lane can delay usable HTTP results or final aggregation;
  • whether Promise.allSettled or cleanup waits retain abandoned work past the public deadline;
  • duplicate Chrome/daemon/broker startup and per-command CDP process overhead;
  • ranking/deduplication and TUI serialization costs;
  • whether provider concurrency and per-engine deadlines should be tuned for the 2–3s target.

A provider failure must degrade to a normal status/partial result, not hang or crash the extension.

3. Safely use the broker performance path

The broker is currently opt-in and must remain so until the envelope/lifecycle work passes independent adversarial review. If enabled for the benchmark, compare it against the legacy path and preserve a bounded legacy fallback. Do not expose CDP IDs/capabilities or unrestricted JavaScript.

Issue #95 (broker lifecycle) and issue #96 (detached cdp.mjs daemon orphans causing severe machine pressure) are prerequisites for any default-on or broad daemon reuse decision. A speed improvement that accumulates orphan processes is a regression.

4. Preserve behavior and safety

  • Google remains the default provider behavior unless a separately reviewed rollout changes it.
  • No live-network dependency in CI.
  • No unsupported universal speedup claim; report sample size and confounds.
  • Preserve prompt-injection handling, SSRF protections, secret redaction, provider status reporting, and public result shape.
  • Bound every child process, timer, socket, request, queue, and cleanup path.

Target acceptance criteria

  • A documented healthy-machine warm benchmark of the full public aio-websearch path reaches p50 <= 3.0 seconds, with a reported p95 target of <= 5.0 seconds where provider/network variance permits.
  • At least 10 warm samples per compared variant, with success/partial-result rate no worse than the current baseline and no silent provider omission.
  • Cold-start performance is reported separately; it is not hidden in the warm target.
  • The configured outer deadline remains authoritative: a stalled provider cannot extend the final response beyond it.
  • HTTP, Google, Reddit, and other participating provider statuses/counts remain internally consistent.
  • Warm/cold and 1/2/4 concurrent-session runs show no persistent child processes, broker clients, daemon sockets, stale locks, or material commit-charge growth after cleanup.
  • npm run lint and the full deterministic suite pass; new lifecycle/performance behavior has deterministic offline tests.
  • An independent adversarial review inspects the actual diff and measurements before merge.

Non-goals

Related work

Activity

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions