This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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: PR 18785: alternative patch


"Joseph S. Myers" <joseph@codesourcery.com> writes:

> On Tue, 15 Feb 2005, Zack Weinberg wrote:
>
>> and call iconv() - and the data in the table is rarely used.  Right
>> now we only need '0' and only in a relatively obscure condition
>> (usually GCC doesn't get to optimize isdigit(), as it's a macro).  The
>> printf logic, IIRC, only needs '%'; that's going to come up frequently
>> enough that it's probably worth caching the result.
>
> isdigit only needs '0'.  isascii and toascii don't really make sense on 
> non-ASCII-compatible character sets and POSIX defines them to follow a 
> specified algorithm independent of locale, so we don't need to do anything 
> with them.  The printf optimizations need '%', 'c', 's', '\n' (format 
> checking needs lots more).  nan parsing needs whitespace, '-', '+', '0' 
> (and other digits but we know they are consecutive after '0'), 'x' and hex 
> digits 'a' to 'f' and 'A' to 'F' (but for some reason we don't accept "0X" 
> prefix in real_nan, only "0x"; this may be a bug).

Thanks for the list.

Is the interface I've provided convenient for all of these routines,
in your opinion?

>> Or, how about I implement a transparent cache inside
>> c_common_to_target_charset?  That way, each value is only ever looked
>> up once, but values never used are never looked up at all.
>
> That makes sense if the performance cost of not caching is measurable.

It's not likely to be measurable for just isdigit(), but once all the
above routines are changed, it may well be.  Are you willing to do the
legwork on updating all the builtins?

zw


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