Skip to content

perf: ⚡ Optimize embedding API calls with Promise.all#190

Closed
Hardonian wants to merge 1 commit into
mainfrom
perf-optimize-embedding-11725820960256189994
Closed

perf: ⚡ Optimize embedding API calls with Promise.all#190
Hardonian wants to merge 1 commit into
mainfrom
perf-optimize-embedding-11725820960256189994

Conversation

@Hardonian

Copy link
Copy Markdown
Owner

💡 What: Replaced sequential await inside a for loop with Promise.all in ingestRecords.
🎯 Why: To parallelize embedding network requests and significantly speed up bulk ingestion of records.
📊 Measured Improvement: Ingestion of 100 simulated delayed records improved from ~1027ms (sequential) to ~12ms (parallel).
Signed-off-by: Jules jules@example.com


PR created automatically by Jules for task 11725820960256189994 started by @Hardonian

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

@github-actions

Copy link
Copy Markdown

This repository limits contributors to 10 open pull requests. Please close or merge existing PRs before opening new ones.

@github-actions github-actions Bot closed this May 29, 2026

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 703cadfafb

ℹ️ 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".

Comment on lines +125 to +127
const embeddedResults = await Promise.all(
input.records.map((record) => input.embedding.embed({ text: record.content }))
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Bound embedding ingestion concurrency

When ingesting a large batch or using a remote embedding adapter with request/rate limits, this starts one embed call per record before any failure can stop the batch. The prior loop naturally kept only one request in flight, so a failing or slow batch can now flood the embedding service and still reject without upserting anything. Please use a bounded worker pool or an adapter-provided batch API rather than raw Promise.all.

Useful? React with 👍 / 👎.

set(key: string, value: RetrievalResponse): void { if (this.available) this.map.set(key, value); }
}

export async function ingestRecords(input: { records: RetrievalIngestionRecord[]; embedding: EmbeddingAdapter; vectorStore: VectorStoreAdapter }): Promise<{ accepted: string[]; degraded: RetrievalDegradedReason[] }> {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Remove the committed .orig source copy

This new .ts.orig file is a stale full copy of the canonical MeshRAG contract under src/lib/control-plane, but it is not imported or covered by the TypeScript globs. Repo-wide source searches already surface both copies, and future edits to meshrag.ts can leave this backup contradicting the canonical contract, creating a parallel truth path under src/. Please remove the editor backup from the commit.

Useful? React with 👍 / 👎.

@Hardonian Hardonian reopened this May 29, 2026
@Hardonian Hardonian closed this May 29, 2026
@Hardonian Hardonian reopened this May 29, 2026
@Hardonian Hardonian closed this May 29, 2026
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