On 04/28/2017 10:27 AM, Jakub Jelinek wrote:
On Fri, Apr 28, 2017 at 10:22:29AM -0600, Jeff Law wrote:
So the initialization could be done once per translation unit rather than
once per function -- assuming the target character set doesn't change within
a translation unit.

That seems like it ought to be easy.

The table-lookup seems like a reasonable cost and I don't think we should
litter the code with conditionals to conditionally lookup based on whether
or not the charsets are the same.

One option would be to have the cache array initialized say to 0 for
all chars except for % (which can be taken from target_percent or how is
that called), and then query (and cache) chars you need (you don't need
anything until % is seen, then obviously you need to translate chars
following that until end of the format string is recognized, then again
skip until next % etc.
That seems like a significant over-complication for little real world benefit.

Jeff

Reply via email to