Re: [PATCH] read-cache: avoid memcpy in expand_name_field in index v4

2013-03-18 Thread Duy Nguyen
On Tue, Mar 19, 2013 at 12:50 AM, Junio C Hamano wrote: > While it is true that strbuf_remove(&sb, sb.len - trim, trim) is > equivalent to strbuf_setlen(&sb, sb.len - trim), I wonder why we see > any memcpy() in the first place. > > strbuf_remove(&sb, sb.len - trim, trim) is turned into > strbuf_s

Re: [PATCH] read-cache: avoid memcpy in expand_name_field in index v4

2013-03-18 Thread Junio C Hamano
Nguyễn Thái Ngọc Duy writes: > perf reports memcpy at the the 6th position [1] in "git status -uno" > using index v4, and strbuf_remove() in expand_name_field() accounts > for 25% of that. What we need here is a simple string cut and a > cheaper strbuf_setlen() should be enough. While it is tru

[PATCH] read-cache: avoid memcpy in expand_name_field in index v4

2013-03-18 Thread Nguyễn Thái Ngọc Duy
perf reports memcpy at the the 6th position [1] in "git status -uno" using index v4, and strbuf_remove() in expand_name_field() accounts for 25% of that. What we need here is a simple string cut and a cheaper strbuf_setlen() should be enough. After this change, memcpy drops down to the 13th positio