Subject: Re: Bugs in str* routines (pr port-pc532/7709, port-pc532/7710)
To: Ian Dall <Ian.Dall@dsto.defence.gov.au>
From: Dave Rand <dlr@above.net>
List: port-pc532
Date: 06/06/1999 06:06:17
[In the message entitled "Re: Bugs in str* routines (pr port-pc532/7709, port-pc532/7710)" on Jun  6, 20:43, Ian Dall writes:]
>  > 
>  > 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.
> 

There is no way (in general) to fix the EoP problem.  In other companies,
this was 'fixed' in the kernel by always allocating n+1 pages for the
.bss and data areas.

strncpy was not one of the benchmarked routines, so was not fixed :-)
It's pretty easy to use this algorithm, until the last 4 bytes of
n, then drop to a byte-by-byte version.


-- 
Dave Rand
CTO, Above.net
NASDAQ: ABOV