Skip to content

perf: offload GitHub API array aggregation and GitRank calculations to a dedicated Web Worker#461

Open
nitishchaubeyy wants to merge 8 commits into
indresh404:mainfrom
nitishchaubeyy:perf/web-worker-offload
Open

perf: offload GitHub API array aggregation and GitRank calculations to a dedicated Web Worker#461
nitishchaubeyy wants to merge 8 commits into
indresh404:mainfrom
nitishchaubeyy:perf/web-worker-offload

Conversation

@nitishchaubeyy

Copy link
Copy Markdown
Contributor

Description

Resolves #441 by mitigating Main Thread locking during massive GitHub API response processing. The heavy aggregation of repository stars, language frequencies, and event sorting now occurs entirely in a background Web Worker, ensuring buttery smooth UI interactions even on low-end devices.

Key Changes

  • Web Worker Extraction: Created gitRankCalculator.worker.js to process arrays of up to 100 repositories and 300 events concurrently. It calculates total commits, PRs, reviews, and dynamic base GitRank.
  • Worker Lifecycle Management: Refactored fetchGitHubStats in AuthContext.jsx to instantiate the Web Worker via Vite's import.meta.url construct.
  • Memory Leak Prevention: Promisified the worker interaction and explicitly invoke worker.terminate() upon both onmessage success and onerror rejection branches.
  • Optimization: Replaced 3 redundant GitHub Search API network calls with a single robust payload parse on the events object, eliminating rate limit collisions while preserving metric accuracy.

Fixes #441

@vercel

vercel Bot commented Jun 11, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
ranker-hub Ready Ready Preview, Comment Jun 11, 2026 9:59am

@github-actions github-actions Bot added backend Backend/Firebase related changes bug Something isn't working enhancement New feature or request frontend Frontend related changes (HTML/CSS/JS/React) gssoc GirlScript Summer of Code gssoc26 GirlScript Summer of Code 2026 nsoc NSoC NSoC'26 NSoC 2026 pending-review PR is pending review labels Jun 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Backend/Firebase related changes bug Something isn't working enhancement New feature or request frontend Frontend related changes (HTML/CSS/JS/React) gssoc GirlScript Summer of Code gssoc26 GirlScript Summer of Code 2026 nsoc NSoC NSoC'26 NSoC 2026 pending-review PR is pending review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Performance][Level 3]: Offload GitHub API Data Aggregation and GitRank Score Calculation to a Web Worker

1 participant