Skip to content

git: Replace regexp in ValidateHex

Will Chandler requested to merge wc/fast-hex-validate into master

In cases where very large numbers of OIDs are parsed by Gitaly, the regular expression used in git.ValidateHex can become extremely expensive.

Fortunately this is not a common scenario, but it's still worth using more efficient but slightly more complex code to validate OIDs to prevent this from happening.

This was quite noticeable when running RepositorySize with the catfile_repo_size feature flag against the Chromium repo. See flamegraph below:

All processes: all-perf.svg

Just Gitaly: gitaly-perf.svg

Edited by Will Chandler

Merge request reports