Re: [PATCH/RFC v2 2/2] Replace strlen() with ce_namelen()

2012-07-08 Thread Junio C Hamano
Thomas Gummerer t.gumme...@gmail.com writes:

 Replace strlen(ce-name) with ce_namelen() in a couple
 of places which gives us some additional bits of
 performance.

 Signed-off-by: Thomas Gummerer t.gumme...@gmail.com

Very sensible, with or without the previous patch.

I am kind of surprised that we are very good and have only these
three places that had these unnecessary pessimization.

 ---
  read-cache.c   |4 ++--
  unpack-trees.c |2 +-
  2 files changed, 3 insertions(+), 3 deletions(-)

 diff --git a/read-cache.c b/read-cache.c
 index ea75c89..a77877a 100644
 --- a/read-cache.c
 +++ b/read-cache.c
 @@ -1124,7 +1124,7 @@ int refresh_index(struct index_state *istate, unsigned 
 int flags, const char **p
   continue;
  
   if (pathspec 
 - !match_pathspec(pathspec, ce-name, strlen(ce-name), 0, 
 seen))
 + !match_pathspec(pathspec, ce-name, ce_namelen(ce), 0, 
 seen))
   filtered = 1;
  
   if (ce_stage(ce)) {
 @@ -1852,7 +1852,7 @@ int read_index_unmerged(struct index_state *istate)
   if (!ce_stage(ce))
   continue;
   unmerged = 1;
 - len = strlen(ce-name);
 + len = ce_namelen(ce);
   size = cache_entry_size(len);
   new_ce = xcalloc(1, size);
   memcpy(new_ce-name, ce-name, len);
 diff --git a/unpack-trees.c b/unpack-trees.c
 index 9981dd3..abd0988 100644
 --- a/unpack-trees.c
 +++ b/unpack-trees.c
 @@ -1289,7 +1289,7 @@ static int verify_clean_subdirectory(struct cache_entry 
 *ce,
* First let's make sure we do not have a local modification
* in that directory.
*/
 - namelen = strlen(ce-name);
 + namelen = ce_namelen(ce);
   for (i = locate_in_src_index(ce, o);
i  o-src_index-cache_nr;
i++) {
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH/RFC v2 2/2] Replace strlen() with ce_namelen()

2012-07-06 Thread Thomas Gummerer
Replace strlen(ce-name) with ce_namelen() in a couple
of places which gives us some additional bits of
performance.

Signed-off-by: Thomas Gummerer t.gumme...@gmail.com
---
 read-cache.c   |4 ++--
 unpack-trees.c |2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/read-cache.c b/read-cache.c
index ea75c89..a77877a 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -1124,7 +1124,7 @@ int refresh_index(struct index_state *istate, unsigned 
int flags, const char **p
continue;
 
if (pathspec 
-   !match_pathspec(pathspec, ce-name, strlen(ce-name), 0, 
seen))
+   !match_pathspec(pathspec, ce-name, ce_namelen(ce), 0, 
seen))
filtered = 1;
 
if (ce_stage(ce)) {
@@ -1852,7 +1852,7 @@ int read_index_unmerged(struct index_state *istate)
if (!ce_stage(ce))
continue;
unmerged = 1;
-   len = strlen(ce-name);
+   len = ce_namelen(ce);
size = cache_entry_size(len);
new_ce = xcalloc(1, size);
memcpy(new_ce-name, ce-name, len);
diff --git a/unpack-trees.c b/unpack-trees.c
index 9981dd3..abd0988 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -1289,7 +1289,7 @@ static int verify_clean_subdirectory(struct cache_entry 
*ce,
 * First let's make sure we do not have a local modification
 * in that directory.
 */
-   namelen = strlen(ce-name);
+   namelen = ce_namelen(ce);
for (i = locate_in_src_index(ce, o);
 i  o-src_index-cache_nr;
 i++) {
-- 
1.7.10.GIT

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html