Skip to content

perf(yaml): use direct assignment for mapping keys#7126

Open
tomas-zijdemans wants to merge 1 commit intodenoland:mainfrom
tomas-zijdemans:yaml-perf1
Open

perf(yaml): use direct assignment for mapping keys#7126
tomas-zijdemans wants to merge 1 commit intodenoland:mainfrom
tomas-zijdemans:yaml-perf1

Conversation

@tomas-zijdemans
Copy link
Copy Markdown
Contributor

  • storeMappingPair and mergeMappings now use direct property assignment instead of Object.defineProperty for ordinary keys. The descriptors defineProperty was writing ({writable, enumerable, configurable} all true) are equivalent to plain assignment, and defineProperty is significantly slower in V8.
  • __proto__ still goes through Object.defineProperty to keep the prototype-chain protection in runtimes that enable the Object.prototype.__proto__ setter.

Based on a wide array of yaml files, I see a consistent 1.24x to 1.43x improvement in mapping-heavy YAML, with no regressions in other payloads

@github-actions github-actions Bot added the yaml label May 5, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.61%. Comparing base (cd03740) to head (77d2a70).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7126   +/-   ##
=======================================
  Coverage   94.61%   94.61%           
=======================================
  Files         634      634           
  Lines       51799    51807    +8     
  Branches     9329     9334    +5     
=======================================
+ Hits        49009    49017    +8     
  Misses       2216     2216           
  Partials      574      574           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant