[PATCH v5 1/2] refs.c: optimize check_refname_component()

2014-06-03 Thread David Turner
In a repository with many refs, check_refname_component can be a major contributor to the runtime of some git commands. One such command is git rev-parse HEAD Timings for one particular repo, with about 60k refs, almost all packed, are: Old: 35 ms New: 29 ms Many other commands which read refs

Re: [PATCH v5 1/2] refs.c: optimize check_refname_component()

2014-06-03 Thread Junio C Hamano
David Turner writes: > static int check_refname_component(const char *refname, int flags) > { > const char *cp; > char last = '\0'; > > for (cp = refname; ; cp++) { > - char ch = *cp; > - if (ch == '\0' || ch == '/') > + unsigned char ch =

[PATCH v5 1/2] refs.c: optimize check_refname_component()

2014-06-01 Thread David Turner
In a repository with many refs, check_refname_component can be a major contributor to the runtime of some git commands. One such command is git rev-parse HEAD Timings for one particular repo, with about 60k refs, almost all packed, are: Old: 35 ms New: 29 ms Many other commands which read refs