Jeff King writes:
> I'd be surprised if it appreciably speeds things up, but I guess it is
> not too complicated to do.
>
>> +static struct {
>> +const char *str;
>> +int len;
>> +} object_type_name[] = {
>> +{ NULL, 0 }, /* OBJ_NONE = 0 */
>> +{ "commit", 6 }, /* OBJ_COMMIT
On Fri, Apr 17, 2015 at 01:54:27PM -0700, Junio C Hamano wrote:
> > Since the strings we are matching are literals, we could also record
> > their sizes in the object_type_strings array and check the length first
> > before even calling strncmp. I doubt this is a performance hot-spot,
> > though.
Jeff King writes:
> When commit fe8e3b7 refactored type_from_string to allow
> input that was not NUL-terminated, it switched to using
> strncmp instead of strcmp. But this means we check only the
> first "len" bytes of the strings, and ignore any remaining
> bytes in the object_type_string. We s
When commit fe8e3b7 refactored type_from_string to allow
input that was not NUL-terminated, it switched to using
strncmp instead of strcmp. But this means we check only the
first "len" bytes of the strings, and ignore any remaining
bytes in the object_type_string. We should make sure that it
is als
4 matches
Mail list logo