Skip to content

perf(ui): parallelize chunked chart download fetches - #2269

Merged
ghostdevv merged 1 commit into
npmx-dev:mainfrom
trivikr:fetch-daily-range-chunked
Mar 25, 2026
Merged

perf(ui): parallelize chunked chart download fetches#2269
ghostdevv merged 1 commit into
npmx-dev:mainfrom
trivikr:fetch-daily-range-chunked

Conversation

@trivikr

Copy link
Copy Markdown
Contributor

🔗 Linked issue

N/A

🧭 Context

Longer date ranges and multi-package comparisons pay avoidable network round-trip time because each chunk waits for the previous one to finish. Parallelizing those chunk requests reduces end-to-end chart load time without changing the returned data shape.

📚 Description

This improves chart loading for large npm download date ranges by parallelizing chunked range fetches in useCharts.

Previously, requests larger than the npm downloads API window were split into multiple chunks and fetched sequentially, which made total latency roughly additive across chunks. This change keeps the existing chunking behavior but fetches chunks with bounded concurrency, then merges the results as before.

@vercel

vercelBot commented Mar 25, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

ProjectDeploymentActionsUpdated (UTC)
npmx.devReadyReadyPreview, CommentMar 25, 2026 6:18am
2 Skipped Deployments
ProjectDeploymentActionsUpdated (UTC)
docs.npmx.devIgnoredIgnoredPreviewMar 25, 2026 6:18am
npmx-lunariaIgnoredIgnoredMar 25, 2026 6:18am

Request Review

@codecov

codecovBot commented Mar 25, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing linesPatch %Lines
app/composables/useCharts.ts0.00%3 Missing ⚠️

📢 Thoughts on this report? Let us know!

@trivikr
trivikrforce-pushed the fetch-daily-range-chunked branch from 8bb1c3b to 2ad2873CompareMarch 25, 2026 06:15
@trivikrtrivikr changed the title perf(charts): parallelize chunked download range fetchesperf(ui): parallelize chunked chart download fetchesMar 25, 2026
@trivikr
trivikr marked this pull request as ready for review March 25, 2026 06:21
@coderabbitai

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 04479310-bfb6-4f81-9050-dc3c0d115061

📥 Commits

Reviewing files that changed from the base of the PR and between eced357 and 2ad2873.

📒 Files selected for processing (1)
  • app/composables/useCharts.ts

📝 Walkthrough

Walkthrough

The fetchDailyRangeChunked() function in the charts composable has been refactored to execute per-chunk fetch requests concurrently rather than sequentially. The function now uses mapWithConcurrency with a concurrency limit of 10 to process chunks in parallel, replacing the previous for...of loop that awaited each chunk individually. The accumulation of daily raw points has changed from incrementally pushing parts into an array to collecting all parts and flattening them in a single operation before merging with mergeDailyPoints(). Public API signatures remain unchanged. The modification spans seven added lines and six removed lines.

🚥 Pre-merge checks | ✅ 1
✅ Passed checks (1 passed)
Check nameStatusExplanation
Description check✅ PassedThe pull request description clearly explains the performance improvement: parallelizing chunked chart fetches to reduce latency for large date ranges and multi-package comparisons.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 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 and usage tips.

@graphierosgraphieros left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome, thank you :)

@ghostdevv
ghostdevv added this pull request to the merge queueMar 25, 2026
Merged via the queue into npmx-dev:main with commit 5b0bfc7Mar 25, 2026
20 of 21 checks passed
@github-actionsgithub-actionsBot mentioned this pull request Mar 25, 2026
@trivikr
trivikr deleted the fetch-daily-range-chunked branch March 25, 2026 18:06
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.

3 participants

@trivikr@ghostdevv@graphieros