Skip to content

Comments

perf: pre-allocate string in compact_context#329

Merged
bug-ops merged 2 commits intomainfrom
perf/preallocate-strings
Feb 15, 2026
Merged

perf: pre-allocate string in compact_context#329
bug-ops merged 2 commits intomainfrom
perf/preallocate-strings

Conversation

@bug-ops
Copy link
Owner

@bug-ops bug-ops commented Feb 15, 2026

Summary

  • Replace format! + collect::<Vec<_>>().join() with String::with_capacity() + std::fmt::Write in compact_context
  • Eliminates intermediate string allocations per message

Closes #316

@github-actions github-actions bot added performance Performance optimization rust core size/S and removed performance Performance optimization labels Feb 15, 2026
@codecov-commenter
Copy link

codecov-commenter commented Feb 15, 2026

Codecov Report

❌ Patch coverage is 92.30769% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/zeph-core/src/agent/context.rs 92.30% 1 Missing ⚠️

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #329      +/-   ##
==========================================
- Coverage   80.37%   80.36%   -0.01%     
==========================================
  Files          99       99              
  Lines       24163    24166       +3     
==========================================
+ Hits        19421    19422       +1     
- Misses       4742     4744       +2     
Files with missing lines Coverage Δ
crates/zeph-core/src/agent/context.rs 85.91% <92.30%> (+0.04%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions github-actions bot added memory Persistence and memory performance Performance optimization labels Feb 15, 2026
@bug-ops bug-ops force-pushed the perf/preallocate-strings branch from a2b0781 to 4b9e605 Compare February 15, 2026 14:07
@bug-ops bug-ops enabled auto-merge (squash) February 15, 2026 14:07
@bug-ops bug-ops merged commit 5f543ee into main Feb 15, 2026
18 checks passed
@bug-ops bug-ops deleted the perf/preallocate-strings branch February 15, 2026 14:16
@bug-ops bug-ops mentioned this pull request Feb 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core memory Persistence and memory performance Performance optimization rust size/S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

perf: pre-allocate strings in context building

2 participants