This is the mail archive of the 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

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).

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

Joseph S. Myers      (personal mail) (CodeSourcery mail) (Bugzilla assignments and CCs)

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