Skip to content

⚡ Bolt: Optimize Listing Audit scoring engine nested lookups#43

Merged
projectamazonph merged 1 commit into
mainfrom
perf/bolt-listing-audit-map-6075910266981458629
Jul 20, 2026
Merged

⚡ Bolt: Optimize Listing Audit scoring engine nested lookups#43
projectamazonph merged 1 commit into
mainfrom
perf/bolt-listing-audit-map-6075910266981458629

Conversation

@projectamazonph

@projectamazonph projectamazonph commented Jul 18, 2026

Copy link
Copy Markdown
Owner

💡 What

Optimized the gradeListingAudit scoring function in src/engine/listing-audit/engine.ts by transforming the reference findings array into a Map lookup.

🎯 Why

In interactive scenarios, the listing audit grading engine evaluates student findings against the reference findings. Previously, the engine performed Array.prototype.find() searches inside the loop bodies of findingsAccuracy and severityCalibration. This created an $O(N \times M)$ time complexity which can be slow as the number of findings grows.

📊 Impact

  • Transforms the algorithmic complexity from $O(N \times M)$ to $O(N + M)$ via $O(1)$ hash map lookups.
  • Reduces CPU cycles and improves response times for student submission evaluations.
  • Under 50 lines of precise, highly-focused changes with zero micro-optimization noise.

🔬 Measurement

All Vitest tests pass cleanly. Verified through pnpm test and code review.


PR created automatically by Jules for task 6075910266981458629 started by @projectamazonph

Summary by CodeRabbit

  • Performance Improvements
    • Improved listing audit scoring efficiency, especially when processing larger sets of findings.
    • Preserved existing accuracy, severity calibration, and empty-submission behavior.

…T-01)

Convert reference findings array to a Map lookup to replace O(N*M) nested scans in findingsAccuracy and severityCalibration with O(1) complexity.

Co-authored-by: projectamazonph <286085559+projectamazonph@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.

@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d9c5b70c-c65f-4d0a-95ef-df8188e2e97f

📥 Commits

Reviewing files that changed from the base of the PR and between d8e32f4 and af1684d.

📒 Files selected for processing (1)
  • src/engine/listing-audit/engine.ts

📝 Walkthrough

Walkthrough

Changes

Listing Audit Lookup

Layer / File(s) Summary
Map-based scoring lookups
src/engine/listing-audit/engine.ts
gradeListingAudit builds a field-keyed reference map, and both scoring criteria use map lookups instead of repeated array searches while preserving existing scoring behavior.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: optimizing nested lookups in the Listing Audit scoring engine.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch perf/bolt-listing-audit-map-6075910266981458629

Comment @coderabbitai help to get the list of available commands.

@projectamazonph
projectamazonph merged commit f4c9d44 into main Jul 20, 2026
5 checks passed
@projectamazonph
projectamazonph deleted the perf/bolt-listing-audit-map-6075910266981458629 branch July 20, 2026 04:32
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.

1 participant