Skip to content

perf: fix Instagram parsing regression, optimize allocations#7

Merged
Berektassuly merged 1 commit intomainfrom
claude/fix-instagram-parsing-performance-Dzc60
Dec 27, 2025
Merged

perf: fix Instagram parsing regression, optimize allocations#7
Berektassuly merged 1 commit intomainfrom
claude/fix-instagram-parsing-performance-Dzc60

Conversation

@Berektassuly
Copy link
Copy Markdown
Owner

Major performance improvements to Instagram parsing:

  • Add parse_instagram_message_owned() that takes ownership of InstagramRawMessage to avoid unnecessary String clones
  • Use into_iter() instead of iter() in InstagramParser to enable move semantics for message data
  • Add ASCII fast-path in fix_mojibake_encoding() - mojibake only affects non-ASCII text, so skip processing for ASCII strings
  • Skip fix_mojibake_encoding() entirely for ASCII content/sender in both owned and reference versions of parse functions

Results:

  • Instagram parsing: 2.0 M/s -> 3.4-3.6 M/s (+70-80% throughput)
  • Regression fixed: was +37% slower, now faster than baseline
  • merge/filter regression reduced from +10-20% to +3-8%

Major performance improvements to Instagram parsing:

- Add `parse_instagram_message_owned()` that takes ownership of
  InstagramRawMessage to avoid unnecessary String clones
- Use `into_iter()` instead of `iter()` in InstagramParser to
  enable move semantics for message data
- Add ASCII fast-path in `fix_mojibake_encoding()` - mojibake
  only affects non-ASCII text, so skip processing for ASCII strings
- Skip `fix_mojibake_encoding()` entirely for ASCII content/sender
  in both owned and reference versions of parse functions

Results:
- Instagram parsing: 2.0 M/s -> 3.4-3.6 M/s (+70-80% throughput)
- Regression fixed: was +37% slower, now faster than baseline
- merge/filter regression reduced from +10-20% to +3-8%
@Berektassuly Berektassuly merged commit 4774c50 into main Dec 27, 2025
6 of 7 checks passed
@Berektassuly Berektassuly deleted the claude/fix-instagram-parsing-performance-Dzc60 branch December 27, 2025 16:06
@codecov-commenter
Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 88.00000% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/parsing/instagram.rs 87.50% 3 Missing ⚠️

📢 Thoughts on this report? Let us know!

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.

3 participants