From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2007-06-19 16:07:46
Mathias Gaunard wrote:
> Richard Day wrote:
>>> Something that would use meta-programming to optimize the generation of
>>> the formatted string would be way better than printf.
>> How does this improve on printf ? Not that I favor printf but I dont see
>> how this is any better.
>> Speed wise yea much better at run time at least, printf is a hog on cpu
>> Do you plan on generating every possible string at compile time ?
>> I call that code bloat.
> I call that lack of understanding.
> What we remove is simply the parsing of the format description, which
> can be done at compile-time.
Yes, it will surely be a bit more efficient, but maybe the run-time
version will be much tinnier (the compile-time parsing will surely
create new types for each formatting need). I'm not against compile-time
parsing engines, but we need really fast compilation times, and tiny
size overhead. I'm maybe too ignorant on this issue (forgive me if I'm
shooting my foot) but compile time generation creates a lot of new types
that lead also to more typeinfo and other stuff to be linked to the program.
My question is if printf is known to be slower than the compile-time
parsing solution. If it's marginally slower, I would prefer the run-time
approach, it's far more flexible (you can change the format on the fly,
and you can't do that at compile time).
Again: I might be saying something stupid. If so, let me know ;-)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk