This is the mail archive of the newlib@sourceware.org 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]
Other format: [Raw text]

Re: [PATCH v2] Add __pure2 to __locale_ctype_ptr(_l)



[Please do not CC me, I'm subscribed to the mailing list anyway.  One
 copy of a list discussion is sufficient.  Thank you!]


On Nov  7 13:53, Wilco Dijkstra wrote:
> Corinna Vinschen wrote: 
> On Nov  6 18:40, Wilco Dijkstra wrote:
> 
> > I tried again on an x86_64 system running gcc 6.4.0, with -O2, -O3, with
> > the original while as well as a for loop, with and without __pure2, and
> > I don't see any difference whatsoever.
> 
> Did you check the call to __locale_ctype_ptr is lifted out of the loop in the
> optimized case? It seems you might just be benchmarking the original version.
> Even GCC4.8 optimizes a slightly modified version of your loop with -O3:
> 
>     for (p = &arr[0]; c = *p++; )
>     {
>       a = ispunct (c);
>       if (a)
>         printf ("holla\n");
>     }
> 
> And it works with -O2 if you split off the p++ in the increment part of the for.

No, it doesn't.  I retried with your style of for loop, but there's
simply no difference for me.  -O2, -O3, pure/ not-pure, with f++ split
off or not, it's always taking the same time on average.

> > So it seems this is very much architecture dependent.  We can surely add
> > __pure2 if it makes a difference on some platforms.
> 
> No this is certainly not architecture dependent. The ctype implementation used to
> be fast, but it is slow now - changes made to ctype last year caused it.

I was talking about the above observation.  The changes to the locale
stuff were necessary to support POSIX.1-2008 locale objects.  If you
think the implementation has flaws, please provide patches.


Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat

Attachment: signature.asc
Description: PGP signature


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