Skip to content

performance improvement#289

Merged
LuqP2 merged 3 commits into
mainfrom
bolt/perf-array-map-set-creation-17527712020462522439
May 17, 2026
Merged

performance improvement#289
LuqP2 merged 3 commits into
mainfrom
bolt/perf-array-map-set-creation-17527712020462522439

Conversation

@LuqP2
Copy link
Copy Markdown
Owner

@LuqP2 LuqP2 commented May 16, 2026

What: Optimized the creation of existingIds Sets in flushPendingImages and appendImagesSilently.
Why: To prevent the memory and time overhead of creating a large intermediate array via .map() before passing it to the Set constructor.
Impact: Reduces memory allocations and speeds up batch processing of images.
Measurement: Compare memory profiling and processing time in store/useImageStore.ts during large catalog loading or syncing.


PR created automatically by Jules for task 17527712020462522439 started by @LuqP2

Replaced `new Set(state.images.map(img => img.id))` with a `for` loop that calls `Set.add()` directly. This avoids $O(N)$ memory allocation and GC overhead associated with creating an intermediate array when flushing or appending thousands of images.

Co-authored-by: LuqP2 <196709044+LuqP2@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.

@LuqP2
Copy link
Copy Markdown
Owner Author

LuqP2 commented May 17, 2026

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@google-labs-jules
Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

Replaced `new Set(state.images.map(img => img.id))` with a `for` loop that calls `Set.add()` directly. This avoids $O(N)$ memory allocation and GC overhead associated with creating an intermediate array when flushing or appending thousands of images.

Co-authored-by: LuqP2 <196709044+LuqP2@users.noreply.github.com>
@LuqP2
Copy link
Copy Markdown
Owner Author

LuqP2 commented May 17, 2026

@jules please resolve the conflicts in this branch.

…et-creation-17527712020462522439

# Conflicts:
#	.jules/bolt.md
#	store/useImageStore.ts
@LuqP2 LuqP2 merged commit 1586a8e into main May 17, 2026
1 check passed
@LuqP2 LuqP2 deleted the bolt/perf-array-map-set-creation-17527712020462522439 branch May 17, 2026 18:20
@google-labs-jules
Copy link
Copy Markdown
Contributor

@jules please resolve the conflicts in this branch.

I've resolved the merge conflicts and made sure the performance optimization is correctly applied to all locations without intermediate array allocation.

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