turbo
53de07f4 - perf: Optimize hotpath memory management and reduce allocations

Commit
96 days ago
perf: Optimize hotpath memory management and reduce allocations - Replace hex::encode(to_be_bytes()) with direct format!("{:016x}") in TurboHash::hash(), eliminating intermediate byte array and the hex crate dependency entirely - Pre-size capnp first segment for FileHashes, LockFilePackages, and LockFilePackagesRef based on entry count, avoiding repeated segment growth allocations during message construction - Use as_str() instead of to_string() for package_dir in TaskHashable serialization, avoiding a per-task-hash String allocation - Replace HashSet with sort_unstable+dedup in calculate_dependency_hashes, removing HashSet hashing overhead and reducing allocations when dependency fan-out is large - Pre-allocate HashMap capacity in RepoGitIndex::get_package_hashes using exact count (full-repo) or BTreeMap range size_hint (per-package) - Use String::new() instead of "".into() for zero-allocation empty string returns in get_external_deps_hash and get_internal_deps_hash https://claude.ai/code/session_01TXs2FAMUjxXr25hLQwTMzF
Author
Parents
Loading