Fix: Parallelize preprocessing to reduce unnecessary latency - #111
Closed
bleedblack1 wants to merge 1 commit into
Closed
Fix: Parallelize preprocessing to reduce unnecessary latency#111bleedblack1 wants to merge 1 commit into
bleedblack1 wants to merge 1 commit into
Conversation
adamjohnwright
added a commit
that referenced
this pull request
Sep 4, 2026
preprocess made three LLM calls back to back. The safety check needs the rephrased text so it must follow the rephrase, but language detection reads the raw user input and does not -- so those two now run concurrently, saving one round trip on every message, on the path every profile shares. Idea from @bleedblack1 in #111. That patch parallelised the same two calls; this is the same change written against current main, since the PR predates 34 commits and its diff no longer applies. Two tests, both checked against the sequential version to confirm they fail on it: one asserting the two calls actually overlap in wall-clock time, one asserting the rephrase still completes before the safety check starts, which is the ordering constraint that must not be lost. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Contributor
|
Thank you — this was a real bug and your report is what surfaced it. Fixed on Closing as resolved rather than stale. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Preprocessing steps were executed sequentially, causing unnecessary latency.
Solution
Replaced sequential execution with parallel processing using asyncio.gather.
Impact
Reduces preprocessing latency by executing independent steps concurrently.
Related Issue
Closes #110