isspace() & i18n
Thu Jun 14 06:57:00 GMT 2001
On Thu, Jun 14, 2001 at 10:32:05AM +0400, egor duda wrote:
> Thursday, 14 June, 2001 Michael Meissner email@example.com wrote:
> >> Yes, we can do block copying, however, the array has forced us to use a
> >> GNU extension. How do you see an array improving speed over a
> >> pointer dereference?
> MM> Well you do have an extra memory reference for pointers (load pointer, then
> MM> load index into array), and the compiler doesn't have an option to know that
> MM> the pointer doesn't change between calls/memory writes, while it can do that
> MM> for an array on systems where you can't fold the array address into the
> MM> instruction. However, I was mainly worried about the cost of doing isspace as
> MM> an out-of-line function vs. array reference.
> i was thinking nobody wants to change isspace() to be out-of-line
> function. i suppose we only want to change array to pointer, and
> that's all. we do lose a bit in term of performance, but that's only one
> extra dereferencing.
> to summarize (as i see it):
> 1) is a bit faster.
> 2) has no risk of dereferencing NULL or invalid pointer.
> 1) works ok when locale resides is read-only segment.
> 2) has no size restrictions (if application wants to provide is*()
> "allowed range for argument" bigger than provided by newlib, it can do
Umm, the no size restriction is bogus. Isspace operates on unsigned chars +
EOF as its legitimate input (ie, if bytes are 8 bits, -1..255).
Michael Meissner, Red Hat, Inc. (GCC group)
PMB 198, 174 Littleton Road #3, Westford, Massachusetts 01886, USA
Work: firstname.lastname@example.org phone: +1 978-486-9304
Non-work: email@example.com fax: +1 978-692-4482
More information about the Newlib