Making the HTTPd run 20% faster with qrintf-gcc; a sprintf-optimizing compiler(blog.kazuhooku.com)
blog.kazuhooku.com
Making the HTTPd run 20% faster with qrintf-gcc; a sprintf-optimizing compiler
http://blog.kazuhooku.com/2014/10/announcing-qrintf-and-qrintf-gcc.html
2 comments
That's a very good question.
My understanding is that the main motivation behind the introduction of iostream was to make a type-safe variant of printf. So with iostreams the _type_ of the value is determined at compile-time, but the representation (e.g. should it be stringified as dec or hex? should it be left-align or right?) needs to be determined at run-time.
In other words, the design issue is only partially solved with iostreams in terms of performance.
My understanding is that the main motivation behind the introduction of iostream was to make a type-safe variant of printf. So with iostreams the _type_ of the value is determined at compile-time, but the representation (e.g. should it be stringified as dec or hex? should it be left-align or right?) needs to be determined at run-time.
In other words, the design issue is only partially solved with iostreams in terms of performance.
Thanks for the answer. Yes, I was aware, that the focus of iostreams was not on performance. But at least I would have some hope, that since less runtime-parsing would be needed (at least in standard cases), a performance benefit could arise. One of the disadvantages of printf is that even in simple cases (e.g. "%s: %d") rather much parsing is needed.
1. nothing generic is as fast as making your own custom solution
2. a lot of libc is lowest common denominator / tons of bloat. printf/sprintf probably does extra locale, multibyte charset, and thread locking shit you don't want.
2. a lot of libc is lowest common denominator / tons of bloat. printf/sprintf probably does extra locale, multibyte charset, and thread locking shit you don't want.
It would be interesting, how the situation is in C++ with its newer stream based output, that is more based on compiler support (as much I know). Does anybody have experiences with it?