projects
/
oweals
/
musl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e3ebe7d
)
trivial optimization to printf: avoid wasted call frame
author
Rich Felker
<dalias@aerifal.cx>
Sat, 11 Aug 2012 02:18:49 +0000
(22:18 -0400)
committer
Rich Felker
<dalias@aerifal.cx>
Sat, 11 Aug 2012 02:18:49 +0000
(22:18 -0400)
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
patch
|
blob
|
history
diff --git
a/src/stdio/printf.c
b/src/stdio/printf.c
index efeb8b3327a391c0dbb677ac8fe315e4f8fd9ae4..7b7c329fabdf0c42527adb873b33baa91a6777f6 100644
(file)
--- 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 = v
printf(
fmt, ap);
+ ret = v
fprintf(stdout,
fmt, ap);
va_end(ap);
return ret;
}