Subject: Re: Bugs in str* routines (pr port-pc532/7709, port-pc532/7710)
To: None <dlr@above.net>
From: Ian Dall <Ian.Dall@dsto.defence.gov.au>
List: port-pc532
Date: 06/06/1999 20:43:24
Dave Rand writes:
 > [In the message entitled "Bugs in str* routines (pr port-pc532/7709, port-pc532/7710)" on Jun  5, 23:33, Ian Dall writes:]
 > > This raises a couple of questions. If the double word at a time
 > > approach is a win, why isn't it used for strncpy and strncmp. OK you
 > > need a bit of extra code to keep count, but not that much. The second
 > > question is are these "smart" algorithms worth it anyway? They look as
 > > though they have quite a bit of extra overhead for short strings and I
 > > would have though that short strings were more common than long ones.
 > > Anyone really concerned with efficient handling of long strings, probably
 > > shouldn't be using null terminated ones anyway!
 > 
 > These tricks are used to increase the performance on certain benchmarks.
 > They are almost always (anything more than 2 bytes) a win.

Good to see you are still there! So, if 2 bytes is a break even point then,
yes it should be worth it. So I suggest that strncpy be converted to use
this approach as well. That still leaves strcmp and strncmp which look
a bit harder if the end of page problem is to be avoided.

Ian