Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

printf

Name: Anonymous 2011-07-30 23:22

printf is bloated. What is a faster alternative?

Name: Anonymous 2011-07-30 23:23

puts

Name: Anonymous 2011-07-30 23:32

>>2
Need a formatted string.

Name: Anonymous 2011-07-30 23:37

>>3
Roll your own.

Name: Anonymous 2011-07-31 3:35

>>1
sf_printf, as in super fast printf*.

* #include "anonix.h"

Name: Anonymous 2011-07-31 4:14

If C had had a decent macro system then printf would've been a macro that expanded to the appropriate series of x -> string conversions and puts statements and we wouldn't have this (admittedly nearly always minor) problem.

Name: Anonymous 2011-07-31 5:06

プリントエフ!!

Name: Anonymous 2011-07-31 5:08

std::cout

Name: Anonymous 2011-07-31 5:14

>>8
std::cout has even more bloat.

Name: Anonymous 2011-07-31 5:32

plan 9 printf is unbloated, you could take that. the reason most printfs are bloated is because of support for locales which involves global locking and table lookups.

Name: Anonymous 2011-07-31 21:11

I think newlib printf is pretty lightweight too. If you decide to take floating point support out it's usually pretty tiny.

Name: Anonymous 2011-08-01 6:57

gcc doesn't optimize calls to printf when the format string contains `%' and is anything else than ``%c'' or ``%s\n''. So, for instance, it will not perform concatenation at compile-time for printf("%s %s\n%s\n", "Hello,", "/prog/!", "^_^").
That's terrible.

Don't change these.
Name: Email:
Entire Thread Thread List