From: Rich Felker Date: Sat, 11 Aug 2012 02:18:49 +0000 (-0400) Subject: trivial optimization to printf: avoid wasted call frame X-Git-Url: http://nsz.repo.hu/git/?p=musl;a=commitdiff_plain;h=4c346919a9b238748de2ee85ce6d749fc3cf7059 trivial optimization to printf: avoid wasted call frame amusingly, this cuts more than 10% off the run time of printf("a"); on the machine i tested it on. sadly the same optimization is not possible for snprintf without duplicating all the pseudo-FILE setup code, which is not worth it. --- diff --git a/src/stdio/printf.c b/src/stdio/printf.c index efeb8b33..7b7c329f 100644 --- a/src/stdio/printf.c +++ b/src/stdio/printf.c @@ -6,7 +6,7 @@ int printf(const char *fmt, ...) int ret; va_list ap; va_start(ap, fmt); - ret = vprintf(fmt, ap); + ret = vfprintf(stdout, fmt, ap); va_end(ap); return ret; }