Git 참조 삭제가 18% 빨라진 이유, Rust가 아니라 C 코드의 사소한 낭비였다

Optimizing Reference Deletions in Git

GitLab 엔지니어가 LLM으로 files backend의 Rust 버전을 만들어 벤치마크하던 중, Rust 쪽이 C보다 17.7% 빠르다는 결과를 발견했다. 원인은 C 코드가 삭제 시 수정되지 않은 참조까지 fprintf와 oid_to_hex로 다시 포맷해 쓰고 있었기 때문. 해당 구간을 fwrite로 원본 그대로 복사하도록 고치자 18% 개선됐고, 이 패치는 master에 병합되어 Git v2.98에 포함될 예정이다.

The C version iterates through the references and writes any unmodified reference to the 'packed-refs' file. But unlike the Rust version, which writes it verbatim, it calls write_packed_entry(). The function rebuilds the information with fprintf() and oid_to_hex(). This is simply unnecessary, since there were no modifications made to the reference.

이 날의 다른 글

2026-11-11