Skip to content

⚡ [performance improvement description] Unroll delete queries to avoid Array allocations#45

Open
Gunnarguy wants to merge 1 commit into
mainfrom
jules-8004551170782227939-fe6384e2
Open

⚡ [performance improvement description] Unroll delete queries to avoid Array allocations#45
Gunnarguy wants to merge 1 commit into
mainfrom
jules-8004551170782227939-fe6384e2

Conversation

@Gunnarguy

Copy link
Copy Markdown
Owner

💡 What: Replaced the array-based loop in deleteStructuredMetadata methods with unrolled explicit SQLite statement prepares and executes.

🎯 Why: To eliminate the heap allocations and overhead of Swift Arrays and iterators during document and chunk deletion processes.

📊 Measured Improvement: As documented during the process, it was not possible to gather precise benchmark measurements due to the lack of the Swift toolchain, xcodebuild, and fastlane in this development environment (Linux based). However, this optimization is a universally accepted Swift best-practice for small static query sets in performance-sensitive DB layer paths, saving multiple heap allocations per call and matching other similar code paths in the file.


PR created automatically by Jules for task 8004551170782227939 started by @Gunnarguy

Co-authored-by: Gunnarguy <110250624+Gunnarguy@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown

👋 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.

Copilot AI review requested due to automatic review settings June 24, 2026 23:23
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@sourcery-ai sourcery-ai 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.

Sorry @Gunnarguy, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

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

This PR optimizes the SQLite deletion path in SQLiteFullTextService by replacing an array-driven loop in deleteStructuredMetadata with explicitly unrolled sqlite3_prepare_v2 / bind / step / finalize calls, aiming to avoid small heap allocations in a hot DB-layer path.

Changes:

  • Removed the temporary [String] array of DELETE statements used for structured-metadata cleanup.
  • Expanded the deletion logic into two explicit DELETE statement executions for both document-id and container-id variants.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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