Re: [TRIVIAL] kstrdup

From: Kai Henningsen (kaih@khms.westfalen.de)
Date: Sat Apr 19 2003 - 06:45:00 EST


root@chaos.analogic.com (Richard B. Johnson) wrote on 18.04.03 in <Pine.LNX.4.53.0304181512220.22901@chaos>:

> The test for every byte transferred is, quite obviously, correct.
> It is also, quite obviously, non optimum.

Actually, that is very much not obvious.

Especially if you're familiar with architectures where every move has an
implicit test (typically for zero and sign), and so checking for the zero
byte during the move is quite obviously the only sane thing to do - the
version with a count is slower, because the inner loop does more. (Those
architectures typically don't have a REP-style prefix.)

MfG Kai
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed Apr 23 2003 - 22:00:26 EST