asm_fprintf inefficiency?
Ian Lance Taylor
iant@google.com
Fri Nov 5 15:01:00 GMT 2010
Jay K <jay.krell@cornell.edu> writes:
> 1) asm_fprintf probably should skip from % to %, calling
> puts on each span, instead of putc one at a time.
> Granted, its input strings tend to be short.
And putc_unlocked is a macro which appends to a buffer. puts is not.
It's not clear that your proposal would actually make gcc run any
faster. Fortunately, this is amenable to a small benchmark program, so
you could try it out.
> given, e.g.:
>
>
> asm_fprintf(file, "%Rfoo");
>
>
> one could instead say
>
>
> #ifndef REGISTER_PREFIX
> #define REGISTER_PREFIX ""
> #endif
>
>
> fprintf(file, "%sfoo", REGISTER_PREFIX);
Sure, it's just less convenient, harder to read, and requires passing an
extra argument.
> (Really I'd rather gcc just output .o files directly...)
It would be an interesting project, but it's not a major component of
optimizing compilation time. I would certainly encourage any interested
party to tackle this, but it's a huge effort with relatively small
payoff.
Ian
More information about the Gcc
mailing list