Commit 5a394f2
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 code1 parent 9f49888 commit 5a394f2
File tree
11 files changed
+367
-51
lines changed- src
- tests
11 files changed
+367
-51
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
0 commit comments