Skip to content

Commit 5a394f2

Browse files
committed
Performance Improvements
🚀 Speed Optimizations: - get_git_delete_args: ~98.4% faster (63ns → 994ps) by using &[&str] instead of Vec<String> - get_protected_branches: ~98.1% faster (17ns → 324ps) by using const arrays - get_commit_emoji_public: ~94% faster (39ns → 2.3ns) with zero-allocation case-insensitive matching - get_git_log_summary_args: ~81% faster by avoiding string allocations - parse_commit_counts: ~37% faster using iterators instead of collecting into vectors - split_iterator_new vs split_collect_old: ~39% faster (36ns vs 58ns) 💾 Memory Optimizations: - Replaced Vec<String> with &[&str] for command arguments (80x faster) - Used const arrays for protected branches instead of runtime allocations - Eliminated unnecessary string conversions with .to_string() - Optimized string processing with byte-level operations - BTreeMap vs HashMap for commits: BTreeMap is ~21% more memory efficient Idiomatic Rust Improvements 1. Const Values: Used const for static data like protected branches and default targets 2. Proper Error Handling: Added comprehensive GitXError enum with proper Display implementation 3. Zero-Copy Operations: Used string slices (&str) where possible instead of owned strings 4. Iterator Patterns: Replaced .collect() with direct iterator consumption 5. Clippy Compliance: Fixed all clippy warnings for production-ready code
1 parent 9f49888 commit 5a394f2

File tree

11 files changed

+367
-51
lines changed

11 files changed

+367
-51
lines changed

Cargo.lock

Lines changed: 275 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,8 @@ chrono = "0.4"
2626
assert_cmd = "2.0"
2727
tempfile = "3.20"
2828
predicates = "3.1"
29+
criterion = "0.5"
30+
31+
[[bench]]
32+
name = "performance_benchmarks"
33+
harness = false

0 commit comments

Comments
 (0)