Skip to content

⚡ Bolt: [performance improvement] Optimize team matching solo groups filtering using Set#151

Open
xb1g wants to merge 1 commit into
mainfrom
bolt/performance-matchteams-filter-set-16182564461271880489
Open

⚡ Bolt: [performance improvement] Optimize team matching solo groups filtering using Set#151
xb1g wants to merge 1 commit into
mainfrom
bolt/performance-matchteams-filter-set-16182564461271880489

Conversation

@xb1g

@xb1g xb1g commented Mar 26, 2026

Copy link
Copy Markdown
Collaborator

💡 What: Replaced !placed.includes(id) with a pre-computed placedSet.has(id) lookup inside the filtering loop for solo groups.

🎯 Why: Calling .includes() on an array inside a .filter() loop results in O(N^2) time complexity. Using a Set provides O(1) lookups, changing the complexity to O(N).

📊 Impact: Significantly improves performance when matching larger numbers of solo students into teams, preventing blocking operations during matching events.

🔬 Measurement: Verified the optimization preserves the exact existing behavior by successfully running the unit test suite pnpm jest components/admin/team-matching/matchTeams.test.ts.


PR created automatically by Jules for task 16182564461271880489 started by @xb1g

…ookups instead of Array.includes()

Co-authored-by: xb1g <70068561+xb1g@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 Mar 26, 2026

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated (UTC)
pseed Ready Ready Preview, Comment Mar 26, 2026 4:03am

Request Review

Copilot AI review requested due to automatic review settings May 11, 2026 17:28
@xb1g
xb1g force-pushed the bolt/performance-matchteams-filter-set-16182564461271880489 branch from 988e97a to a9ed935 Compare May 11, 2026 17:28
@vercel

vercel Bot commented May 11, 2026

Copy link
Copy Markdown
Contributor

Unable to deploy a commit from a private repository on your GitHub organization to the wachaa1319's projects team on Vercel, which is currently on the Hobby plan. In order to deploy, you can:

  • Make your repository public or
  • Upgrade to Pro. A Pro subscription is required to deploy from a private organization repository.

To read more about collaboration on Vercel, click here.

Copilot AI 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.

Pull request overview

Improves the performance of the team-matching algorithm (admin “team matching” flow) by avoiding repeated linear lookups when filtering remaining solo users, which helps keep matching responsive for larger cohorts.

Changes:

  • Precomputes a Set of placed solo user IDs and uses Set.has() instead of Array.includes() during remaining-solos filtering.
  • Minor formatting/line-break adjustments that don’t change behavior.

@xb1g
xb1g force-pushed the bolt/performance-matchteams-filter-set-16182564461271880489 branch 2 times, most recently from 653085e to d5d0dde Compare May 11, 2026 17:39
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented May 11, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
❌ Deployment failed
View logs
web d5d0dde May 11 2026, 06:22 PM

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.

2 participants