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 Wed, Jun 13, 2001 at 02:09:45PM -0400, J. Johnston wrote:
> Christopher Faylor wrote:
> > 
> > On Mon, Jun 11, 2001 at 07:44:16PM -0400, Michael Meissner wrote:
> > >On Mon, Jun 11, 2001 at 06:32:09PM -0400, J. Johnston wrote:
> > >>Using an array is the wrong way to implement ctype.  For example, if we
> > >>ever want to try and add better locale support.  I would like to switch
> > >>over at the earliest possible time.  What would you perceive a
> > >>reasonable delay to ensure that most Cygwin users won't see a problem?
> > >>(x releases or n time)
> > >
> > >IMHO, using an array is perfectly fine.  When setlocale is called, you
> > >use memcpy or some such to update the array.  After all, in most
> > >programs, the number of times you call isspace and friends far, far
> > >outweighs the number of times you call setlocale.
> > 
> > I agree.  We're interested in speed with these "functions" so I think that
> > an array makes sense.  For setlocale we could come up with some type of
> > scheme for block copying in changed sections as Mike suggests.
> > 
> > The only problem with this plan is that it doesn't accomodate ROMs or
> > read-only sections very well.  I don't know if that is an issue or not.
> > 
> > cgf
> 
> 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?

Well you do have an extra memory reference for pointers (load pointer, then
load index into array), and the compiler doesn't have an option to know that
the pointer doesn't change between calls/memory writes, while it can do that
for an array on systems where you can't fold the array address into the
instruction.  However, I was mainly worried about the cost of doing isspace as
an out-of-line function vs. array reference.

> The read-only section issue will catch up with us eventually.
> 
> I have no problem with leaving this asis for the short/medium term.  In the
> long term, this should be changed.  It is cleaner (no GNUC trickery), more 
> efficient for implementing setlocale, and I see no reason to protect a Cygwin user 
> who attempts to use a Cygwin x.0 dll with Cygwin x+45.0 header files.  However,
> I do acknowledge there is a reasonable amount of time and releases to prevent
> chaos from ensuing.  I was just attempting to get a feel for how long that period was.

Bear in mind, I tend to view it through the embedded computer usage and not the
cygwin usage.

-- 
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]