Skip to content

Issue: Optimize Timeframe Lookup Complexity Using a Map #407

Open

Description

@Yashaswini-K-P

File Name

scripts/sync-leaderboard.js

Problem

Inside processTimeframe, the script uses .findIndex() inside a loop to find previous user data:

const previousIndex = previousData.findIndex((obj) => obj.id === item.id); 

Scanning an array repeatedly inside loops leads to $O(N^2)$ inefficiency as the student user base scales up.

Proposed Solution

Convert the previousData array into a Map before chunk processing to ensure $O(1)$ lookups.

Activity

  1. github-actions commented on Aug 3, 2026

    @github-actions
    Contributor

    Thank you for opening an issue.

    Please review our CONTRIBUTING.md guidelines before getting started.

    A maintainer will review this issue shortly. If you would like to work on the issue yourself, please leave a comment requesting assignment.

    Issue Assignment Policy

    • The issue creator is given the first priority to work on their issue.
    • If the creator declines or does not request assignment, the issue will be assigned to others in the order of requests received.
    • Please do not submit PRs or begin work until you are officially assigned.

    Note: This project is currently maintained by a solo maintainer, so reviews, assignments, and responses may sometimes take a little time. Thanks for your patience.

  2. aaniya22 commented on Aug 6, 2026

    @aaniya22
    Contributor

    pls assign this to me under gssoc

  3. added
    level:advanced
    Backend
    on Aug 8, 2026
  4. github-actions commented on Aug 23, 2026

    @github-actions
    Contributor

    This issue has been inactive for 14 days and has been marked as stale. To keep this issue open, please leave a comment.

  5. Yashaswini-K-P commented on Aug 29, 2026

    @Yashaswini-K-P
    ContributorAuthor

    working

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

Metadata

Metadata

Labels

Backendlevel:advancedtype:performance

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions