Repository navigation
Report where trace capture time goes, behind DEVTOOLS_CAPTURE_TIMING - #519
Merged
Merged
Conversation
This was referenced Oct 30, 2026
Trace mode is slower than live mode because of the per-action capture, and nothing measured where that time goes per platform, so any proposal to make capture cheaper was a guess (#516). With DEVTOOLS_CAPTURE_TIMING set, every capture records each probe's issue and settle times, its service time apart from the time it queued behind the driver's earlier requests, and what triggered it (an action, a wait's poll, a matcher's poll). At trace export the run prints a summary per probe and writes the raw records as NDJSON. It only measures: probe order, concurrency and what is captured are unchanged, and with the variable unset no timer is created. All three JS adapters get it from core; Python mirrors it, with the summary checked by shared mirror vectors. Refs #516 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
vishnuv688
force-pushed
the
ci/511-hosted-player-e2e
branch
from
October 30, 2026 10:12
357cead to
dcf13e9
Compare
vishnuv688
force-pushed
the
perf/516-capture-timing
branch
from
October 30, 2026 10:13
9314b3f to
09ddb75
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Part of #516 (step 1 of 2: measurement). Stacked on #518.
Trace mode is slower than live mode because of the per-action capture, and nothing measured where that time goes per platform, so any proposal to make capture cheaper was a guess. With
DEVTOOLS_CAPTURE_TIMING=1, every capture is timed probe by probe and the run prints a summary at trace export, plus raw NDJSON records to share. It only measures: what is captured, probe order and concurrency are unchanged.Type of change
Packages touched
shared(types and contracts)core(framework-agnostic capture/reporting)elements(published element/snapshot API —@wdio/elements)service(WebdriverIO adapter)nightwatch-devtools(Nightwatch adapter)selenium-devtools(Selenium adapter)selenium-devtools-py(Selenium Python adapter)backend(server)app(UI)script(page-injected runtime)trace(Trace mode)Capability matrix
packages/conformance/src/features.tsupdated, and tables regenerated withpnpm docs:capabilities, if this adds or changes user-facing behaviourNot a capability:
DEVTOOLS_CAPTURE_TIMINGis listed incapability-options.tsas a diagnostic (notFeature).Notes for reviewers
Why this is in
core, though it touches every adapter: all three JS adapters capture throughcore'scaptureActionSnapshot, so the recording lives there, and reporting hooks intofinalizeTraceExport. Each adapter only passes one optional argument: what triggered the capture. Python cannot importcore, so it mirrors the recording and summary, and both summaries are checked against the same cases inmirror-vectors.json.What a record holds: each probe's issue and settle times; its service time (settle minus the later of its own issue and the previous probe's settle), which separates a probe's own cost from time queued behind the driver's earlier requests; whether the read came back empty; the in-process build time (
process, page-source parsing and locators on native); the whole capture; native or not; the command; and the trigger: an action, a wait's poll (Selenium, Nightwatch), a matcher's poll (WDIO, withcaptureAssertionson), or the final capture.Off by default, at no cost: with the variable unset, no timer is created and
timed()returns the probe's own promise. Any value other than empty,0,false,nooroffturns it on, as Python's existingDEVTOOLS_*switches read.Sample output (from a unit-test fixture, not a real run)
Testing
pnpm install --frozen-lockfile,pnpm build,pnpm test(3411 passed) andpnpm lintare green; the Python suite passes (849 tests) and its change fragment is present; no workspace import leaks in the adapter bundles.Next (step 2 of #516): run the commands in the README's new "Measuring capture cost" section on each platform and post the numbers to #516, before proposing any change to capture. Only Selenium's example switches browser (
SELENIUM_BROWSER); the other desktop examples run Chrome.Not in this PR: the docs-site mirror of the README section, with the other docs-site changes once trace.webdriver.io is live.
Screenshots / recordings
Not applicable: no UI change.
🤖 Generated with Claude Code