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)


On Oct 31 13:34, Wilco Dijkstra wrote:
> The newlib ctype functons are extremely inefficient due to repeatedly
> calling __locale_ctype_ptr for every single use of a ctype macro, even
> in a tight loop.  Improve this by adding the missing __pure2 attribute so
> the pointer can be cached just like in GLIBC, resulting in > 2x speedup
> in loops.

Apart from Craig's comment, how did you test this?  I checked this on
x86_64 Cygwin with input of 300 Megs, and I didn't see any difference
between using the current code and an additional __pure2.  A tight loop
around these 300 Megs of input always took 2.3 - 2.4 secs.

My testcase is attached.  Input file as parameter with no punctuation
chars (so the printf is deliberately never called, but GCC's optimization
doesn't discard the result of ispunct.


Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat

Attachment: ctype-pure2-test.c
Description: Text document

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]