Skip to content

perf(cache): avoid repeated cache index copies - #3847

Open
onmax wants to merge 1 commit into
nuxt:mainfrom
onmax:local/content-cache-index
Open

perf(cache): avoid repeated cache index copies#3847
onmax wants to merge 1 commit into
nuxt:mainfrom
onmax:local/content-cache-index

Conversation

@onmax

@onmaxonmax commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

🔗 Linked issue

No linked issue.

❓ Type of change

  • 📖 Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

Build the development-cache lookup without copying every prior property for each row. This preserves last-row-wins behavior and special IDs.

DescriptionGitHub
BeforeIndexing 300 cached documents copies 45,150 existing properties.Source
AfterIndexing the same 300 documents copies no existing properties.Source

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

Build the development cache lookup in linear time while preserving row semantics.
@vercel

vercelBot commented Sep 5, 2026

Copy link
Copy Markdown

@onmax is attempting to deploy a commit to the Nuxt Team on Vercel.

A member of the Team first needs to authorize it.

@pkg-pr-new

pkg-pr-newBot commented Sep 5, 2026

Copy link
Copy Markdown
npm i https://pkg.pr.new/@nuxt/content@3847

commit: fdc1be7

@coderabbitai

coderabbitaiBot commented Sep 5, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: d40c2549-de02-43ac-9a3f-f15953e708f0

📥 Commits

Reviewing files that changed from the base of the PR and between 656a5ce and ca08234.

📒 Files selected for processing (2)
  • src/utils/database.ts
  • test/unit/developmentCacheIndex.test.ts

Included review availability: Your plan provides up to 8 included reviews per hour; 5 remain after this review.


📝 Walkthrough

Walkthrough

fetchDevelopmentCache now uses Object.fromEntries to build the id-keyed cache record. New unit tests cover empty results, duplicate ids, insertion order, and special ids such as __proto__ and constructor.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk:⚪ Minimal · up to fdc1b

Development-cache indexing now builds records in linear time while preserving expected duplicate and special-ID behavior. The changed behavior is covered by focused unit tests, with no current merge-blocking risk identified.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files.Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check nameStatusExplanation
Linked Issues check✅ PassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes check✅ PassedCheck skipped because no linked issues were found for this pull request.
Title check✅ PassedThe title clearly describes the main performance change: avoiding repeated cache index copies.
Description check✅ PassedThe description explains the performance improvement and confirms preservation of last-row-wins behavior and special IDs.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@onmax
onmaxforce-pushed the local/content-cache-index branch from ca08234 to fdc1be7CompareSeptember 5, 2026 08:49
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@onmax