This is the mail archive of the newlib@sources.redhat.com mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: isspace() & i18n


On Thu, Jun 14, 2001 at 10:32:05AM +0400, egor duda wrote:
> Hi!
> 
> Thursday, 14 June, 2001 Michael Meissner meissner@cygnus.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):
> array:
> 1) is a bit faster.
> 2) has no risk of dereferencing NULL or invalid pointer.
> 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
> so.

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:	  meissner@redhat.com		phone: +1 978-486-9304
Non-work: meissner@spectacle-pond.org	fax:   +1 978-692-4482


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]