perf(imap): batch body-part fetches in getBodyStructureData#13131
Draft
hamza221 wants to merge 1 commit into
Draft
perf(imap): batch body-part fetches in getBodyStructureData#13131hamza221 wants to merge 1 commit into
hamza221 wants to merge 1 commit into
Conversation
Resolve each message's body MIME IDs from the already-fetched structures and request the union of all body parts in a single fetch covering every UID, instead of one fetch per message. This removes the N+1 fetch pattern: any batch now costs exactly two fetches (structures + body parts) regardless of size. Assisted-by: Claude:claude-opus-4-8[1m] Signed-off-by: Hamza <hamzamahjoubi221@gmail.com>
49cf117 to
cc395d6
Compare
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.
Before
getBodyStructureData benchmark: 5 UID(s) in 2327.36 ms
getBodyStructureData benchmark: 20 UID(s) in 8091.76 ms
getBodyStructureData benchmark: 8 UID(s) in 4658.03 ms
getBodyStructureData benchmark: 20 UID(s) in 8009.11 ms
getBodyStructureData benchmark: 37 UID(s) in 13710.65 ms
After
getBodyStructureData benchmark: 5 UID(s) in 3285.25 ms
getBodyStructureData benchmark: 20 UID(s) in 1237.34 ms
getBodyStructureData benchmark: 22 UID(s) in 1126.85 ms
getBodyStructureData benchmark: 20 UID(s) in 1421.08 ms
getBodyStructureData benchmark: 37 UID(s) in 1878.88 ms
Assisted-by: Claude:claude-opus-4-8[1m]
🤖 AI (if applicable)