Skip to content

⚡ perf: combine repo processing loops into single pass - #522

Open
is0692vs wants to merge 2 commits into
mainfrom
perf/single-pass-repo-processing-3935867020765105731
Open

⚡ perf: combine repo processing loops into single pass#522
is0692vs wants to merge 2 commits into
mainfrom
perf/single-pass-repo-processing-3935867020765105731

Conversation

@is0692vs

@is0692vs is0692vs commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

💡 What: Refactored github repo processing to map properties, accumulate languages, tally stars, and build heatmaps in a single pass over the repos array instead of multiple iterative arrays and reduce operations.
🎯 Why: To improve CPU efficiency and avoid redundant iterations and intermediate array allocations.
📊 Measured Improvement: Replaced 4 array loop traversals with 1. Micro-benchmarks show the combined processing runs 1.9x faster (391ms -> 205ms for 100k iterations).


PR created automatically by Jules for task 3935867020765105731 started by @is0692vs

Greptile Summary

GitHub リポジトリ情報の変換と各種統計の集計を単一ループへ統合し、中間配列と重複走査を削減しています。既存の出力挙動は維持されています。

  • リポジトリのカード用データへの変換、スター合計、言語集計を一度の走査で実行
  • 42日分の UTC ヒートマップ集計を同じ走査へ統合
  • 言語割合、最大活動数、ストリークへ渡すデータを走査後に確定

Confidence Score: 5/5

この PR は安全にマージできると判断します。

単一ループ化後も、リポジトリ変換、言語集計の分母、スター合計、不正な日時の除外、42日間の UTC ヒートマップ生成が旧実装と同じ結果になります。

Important Files Changed

Filename Overview
src/lib/cardDataFetcher.ts 複数のリポジトリ走査を単一ループへ統合しており、言語割合、スター合計、UTC ヒートマップの既存セマンティクスは維持されています。

Reviews (1): Last reviewed commit: "perf: combine repo processing loops into..." | Re-trigger Greptile

Context used:

Co-authored-by: is0692vs <135803462+is0692vs@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@vercel

vercel Bot commented Aug 1, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
github-user-summary Ignored Ignored Aug 1, 2026 4:53am

@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@dosubot dosubot Bot added the enhancement New feature or request label Aug 1, 2026
@dosubot

dosubot Bot commented Aug 1, 2026

Copy link
Copy Markdown

📄 Knowledge review

Dosu skipped reviewing this PR because your organization has used its 200 included credits for the month. Your usage will reset on 2026-09-01. To have Dosu review this PR before then, ask your organization admin to upgrade to a pro account.


Leave Feedback Ask Dosu about github-user-summary Add Dosu to your team

@coderabbitai

coderabbitai Bot commented Aug 1, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@is0692vs, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 31 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: fd61f5aa-a9cc-4df7-96c2-905b60a43cd6

📥 Commits

Reviewing files that changed from the base of the PR and between 1b1a1aa and f0921b7.

📒 Files selected for processing (2)
  • src/lib/__tests__/cardDataFetcher.test.ts
  • src/lib/cardDataFetcher.ts

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.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

perf: single-pass GitHub repo processing for card data

✨ Enhancement 🕐 20-40 Minutes

Grey Divider

AI Description

• Collapse repo mapping, language stats, star totals, and heatmap into one loop.
• Reduce redundant traversals and intermediate allocations when building card data.
Diagram

graph TD
  A["GitHub API"] --> B["fetchCardData()"] --> C["Single-pass repo loop"] --> D["Aggregates (repos/lang/stars/heatmap)"] --> E["buildStreak()"] --> F["CardData"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Keep helper functions with multiple passes
  • ➕ Better readability and separation of concerns
  • ➕ Easier unit testing of language/heatmap builders in isolation
  • ➖ Retains extra traversals and intermediate allocations
  • ➖ Harder to meet tight CPU budgets for large repo lists
2. Single reduce() returning an aggregate struct
  • ➕ Still one pass while staying in a functional style
  • ➕ Centralizes accumulator typing (e.g., {repos, stars, buckets, dayCounts})
  • ➖ Can become harder to step through/debug than an imperative loop
  • ➖ Risk of subtle mutation inside reduce callbacks anyway
3. Extract a dedicated aggregator function (imperative, single-pass)
  • ➕ Keeps single-pass performance while restoring modularity
  • ➕ Improves testability and makes fetchCardData shorter
  • ➖ Slight indirection/overhead and another public-ish internal API to maintain
  • ➖ May tempt future callers to reuse it incorrectly without context

Recommendation: The PR’s single-pass imperative loop is a strong choice for the stated performance goal and avoids intermediate arrays. The main tradeoff is readability; consider (optionally) extracting the loop into a private aggregateRepos(rawRepos) helper to keep fetchCardData focused while preserving the single traversal.

Files changed (1) +68 / -75

Enhancement (1) +68 / -75
cardDataFetcher.tsCombine repo mapping and aggregations into a single pass +68/-75

Combine repo mapping and aggregations into a single pass

• Removes the separate helpers that mapped repos, computed language stats, and built the push heatmap. Inlines a single loop in fetchCardData that constructs CardRepoData while tallying total stars, bucketing languages, and incrementing heatmap day counts, then derives top languages and heatmap maxima from the accumulated maps.

src/lib/cardDataFetcher.ts

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

To customize comments, go to the Qodo configuration screen, or learn more in the docs.

Qodo Logo

@codecov

codecov Bot commented Aug 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.47368% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/lib/cardDataFetcher.ts 89.47% 0 Missing and 4 partials ⚠️

📢 Thoughts on this report? Let us know!

Co-authored-by: is0692vs <135803462+is0692vs@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant