Repository navigation
⚡️ Halve the Live Debugger's capture time for objects with many keys - #5217
gh-worker-dd-mergequeue-cf854d[bot] merged 4 commits into
Conversation
captureObjectProperties listed an object's own keys to compute the field count, then captureObjectPropertiesFields listed them again to pick the fields to capture. Each listing is one built-in call that the capture deadline can't interrupt. For an object with 100k keys it takes about 34 ms in Chromium. List the keys once and pass them to captureObjectPropertiesFields. captureFields still lists its own. Environment: Datadog workspace Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Bundles Sizes Evolution
|
🎉 All green!🧪 All tests passed 🎯 Code Coverage (details) 🔗 Commit SHA: cfa6880 | Docs | View more details | Give us feedback! |
There was a problem hiding this comment.
More details
Reusing the key list preserves string/symbol ordering and field-limit output while eliminating duplicate enumeration. Runtime behavior remains unverified because dependencies are not installed.
🤖 Bits Code Review · Commit ce782bc
It checked calls to built-in functions rather than output. The existing "should truncate objects with many fields" test already covers size and fieldCount. Environment: Datadog workspace Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Environment: Datadog workspace Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
/merge |
|
View all feedbacks in Devflow UI.
The expected merge time in
Build pipeline has failing jobs for 2dc414f: What to do next?
|
|
/merge |
|
View all feedbacks in Devflow UI.
The expected merge time in
|
Motivation
When the Live Debugger captures an object, it fetches the object's property names twice.
captureObjectPropertiesfetches them to count the fields, thencaptureObjectPropertiesFieldsfetches them again to choose which fields to capture. Snapshots are correct and contain each field once: the duplicate is internal work, not output. This has been there since #4449.Fetching the names builds an array of all the object's own property names, which gets slow for objects with many properties. It's a single built-in call, so the 10 ms capture deadline can't interrupt it. For an object with 100k string keys, fetching the names once (
getOwnPropertyNames,getOwnPropertySymbolsand the concat) takes about 34 ms in Chromium, 2 ms in Firefox and 8 ms in WebKit (headless Playwright on a Neoverse N1 CPU).This affects every snapshot, not only Exception Replay: probe captures on entry, return and throw, and capture expressions.
Changes
Fetch the property names once in
captureObjectPropertiesand pass them tocaptureObjectPropertiesFields.captureFields, used for arguments and locals, still fetches its own. Snapshots don't change.Capturing a 100k-key object as a function argument in Chromium:
Test instructions
Run
yarn test:unit --spec packages/browser-debugger/src/domain/capture.spec.ts. The existing tests cover the captured output, includingsizeandfieldCount.Checklist
🤖 Generated with Claude Code