Skip to content

perf: avoid reloading skill graph during recommendation scoring#1245

Merged
komalharshita merged 2 commits into
komalharshita:mainfrom
DevChinmaysamal17:fix/optimize-skill-graph-loading
Jul 18, 2026
Merged

perf: avoid reloading skill graph during recommendation scoring#1245
komalharshita merged 2 commits into
komalharshita:mainfrom
DevChinmaysamal17:fix/optimize-skill-graph-loading

Conversation

@DevChinmaysamal17

Copy link
Copy Markdown
Contributor

Summary

This PR improves the performance of the recommendation pipeline by avoiding repeated loading of the skill graph during project scoring.

Previously, score_single_project() loaded skill_graph.json for every project being evaluated, resulting in unnecessary filesystem I/O and repeated JSON parsing. This change loads the skill graph once in get_recommendations() and reuses the same instance throughout the recommendation process.

Related Issue

N/A

Type of Change

  • Refactor — restructures code without changing behaviour

What Was Changed

File Change made
src/utils/recommender.py Load the skill graph once per recommendation request and pass it to score_single_project() instead of reloading it for every project.

How to Test This PR

  1. Clone the repository and checkout this branch.
  2. Create and activate a virtual environment.
  3. Install dependencies:
    pip install -r requirements.txt
  4. Run the test suite:
    python -m pytest
  5. Verify that all tests pass and the recommendation functionality behaves as before.

Test Results

278 passed, 3 skipped in 5.17s

Notes for Reviewer

This change is intentionally limited to a performance optimization. It does not modify the recommendation algorithm or the API response. The only change is reusing a single loaded skill graph during a recommendation request to eliminate redundant file reads.

@vercel

vercel Bot commented Jun 30, 2026

Copy link
Copy Markdown

@DevChinmaysamal17 is attempting to deploy a commit to the komalsony234-1530's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added gssoc-2026 type:bug Something isn't working labels Jun 30, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thank you for submitting your first pull request to DevPath.

Before review:

  • Complete the PR template fully
  • Ensure all tests pass
  • Link your PR to an issue
  • Keep changes scoped to the issue

A maintainer will review your contribution soon.

@komalharshita
komalharshita merged commit 51398bd into komalharshita:main Jul 18, 2026
4 of 5 checks passed
@komalharshita

Copy link
Copy Markdown
Owner

Looks good! This PR provides a clean performance optimization by loading the skill graph once per recommendation request instead of reloading it for every project evaluation. The change reduces unnecessary file I/O while preserving the existing recommendation logic and API behavior. The implementation is well-scoped, and the included test results indicate no regressions. I don't see any blocking issues.

Approved for merge. ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants