Skip to content

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

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

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

Conversation

@trivikr
Copy link
Copy Markdown
Contributor

@trivikr trivikr commented Mar 25, 2026

🔗 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
Copy link
Copy Markdown

vercel bot commented Mar 25, 2026

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

Project Deployment Actions Updated (UTC)
npmx.dev Ready Ready Preview, Comment Mar 25, 2026 6:18am
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs.npmx.dev Ignored Ignored Preview Mar 25, 2026 6:18am
npmx-lunaria Ignored Ignored Mar 25, 2026 6:18am

Request Review

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 25, 2026

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 lines Patch % Lines
app/composables/useCharts.ts 0.00% 3 Missing ⚠️

📢 Thoughts on this report? Let us know!

@trivikr trivikr force-pushed the fetch-daily-range-chunked branch from 8bb1c3b to 2ad2873 Compare March 25, 2026 06:15
@trivikr trivikr changed the title perf(charts): parallelize chunked download range fetches perf(ui): parallelize chunked chart download fetches Mar 25, 2026
@trivikr trivikr marked this pull request as ready for review March 25, 2026 06:21
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 25, 2026

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 name Status Explanation
Description check ✅ Passed The 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.

Copy link
Copy Markdown
Contributor

@graphieros graphieros left a comment

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 queue Mar 25, 2026
Merged via the queue into npmx-dev:main with commit 5b0bfc7 Mar 25, 2026
20 of 21 checks passed
@github-actions github-actions bot mentioned this pull request Mar 25, 2026
@trivikr trivikr deleted the fetch-daily-range-chunked branch March 25, 2026 18:06
Sign up for free to 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