From 4c346919a9b238748de2ee85ce6d749fc3cf7059 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Fri, 10 Aug 2012 22:18:49 -0400 Subject: [PATCH] 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. --- src/stdio/printf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; } -- 2.25.1