"Shawn O. Pearce" <spearce@spearce.org> wrote:... ... DrNick suggested on #git to try flipping the isspace test around. This is a smaller change and generated the same ~3.60 seconds run as Dscho's patch. I like DrNick's version better. ;-) -->8-- [PATCH] xdiff/xutils.c(xdl_hash_record): factor out whitespace handling Since in at least one use case, xdl_hash_record() takes over 15% of the CPU time, it makes sense to even micro-optimize it. For many cases, no whitespace special handling is needed, and in these cases we should not even bother to check for whitespace in _every_ iteration of the loop. Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Shawn O. Pearce <spearce@spearce.org> --- xdiff/xutils.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/xdiff/xutils.c b/xdiff/xutils.c index 3653864..7b1f213 100644 --- a/xdiff/xutils.c +++ b/xdiff/xutils.c @@ -241,7 +241,7 @@ unsigned long xdl_hash_record(char const **data, char const *top, long flags) { char const *ptr = *data; for (; ptr < top && *ptr != '\n'; ptr++) { - if (isspace(*ptr) && (flags & XDF_WHITESPACE_FLAGS)) { + if ((flags & XDF_WHITESPACE_FLAGS) && isspace(*ptr)) { const char *ptr2 = ptr; while (ptr + 1 < top && isspace(ptr[1]) && ptr[1] != '\n') -- 1.5.1.rc1.595.gd1206 -- Shawn. - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
| Greg KH | [RFC] sample kobject implementation |
| Greg Kroah-Hartman | [PATCH 001/196] Chinese: Add the known_regression URI to the HOWTO |
| Paul E. McKenney | [PATCH RFC 2/9] RCU: Fix barriers |
| Joe Perches | [PATCH 011/148] include/asm-x86/bug.h: checkpatch cleanups - formatting only |
git: | |
| Jarek Poplawski | [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| Gerrit Renker | [PATCH 15/37] dccp: Set per-connection CCIDs via socket options |
| Linus Torvalds | Re: [GIT]: Networking |
| Jeff Garzik | Re: [PATCH] drivers/net: remove network drivers' last few uses of IRQF_SAMPLE_RANDOM |
