isspace() & i18n

egor duda
Wed Jun 13 23:32:00 GMT 2001


Thursday, 14 June, 2001 Michael Meissner 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

for me, pointer is preferable in the long run.

Egor.   ICQ 5165414 FidoNet 2:5020/496.19

More information about the Newlib mailing list