How we decreased GitLab repo backup times from 48 hours to 41 minutes
Jun 5, 2025Karthik Nayak

Summary
This post details a fix for an O(N^2) complexity in Git's `object_array_remove_duplicates()` function, which was causing extremely long repository backup times. The fix replaces nested loops with a map data structure, improving performance by 6x in benchmarks and reducing GitLab's largest repository backup time from 48 hours to 41 minutes. This improvement was upstreamed to Git and backported for immediate customer benefit.