[6.0] eff757e8b trivial vtim printf benchmark
Dridi Boukelmoune
dridi.boukelmoune at gmail.com
Wed Oct 31 13:08:26 UTC 2018
commit eff757e8bccfb3612f846c74feaca43b616a264b
Author: Nils Goroll <nils.goroll at uplex.de>
Date: Fri Oct 5 09:56:27 2018 +0200
trivial vtim printf benchmark
diff --git a/lib/libvarnish/vtim.c b/lib/libvarnish/vtim.c
index a9fbc7cb2..f9de6244e 100644
--- a/lib/libvarnish/vtim.c
+++ b/lib/libvarnish/vtim.c
@@ -511,6 +511,7 @@ bench()
{
double s, e, t;
int i;
+ char buf[64];
t = 0;
s = VTIM_real();
@@ -527,6 +528,17 @@ bench()
e = VTIM_real();
printf("mono: %fs / %d = %fns - tst val %f\n",
e - s, i, 1e9 * (e - s) / i, t);
+
+ t = 0;
+ s = VTIM_mono();
+ for (i=0; i<100000; i++) {
+ snprintf(buf, sizeof(buf), "%.6f", s);
+ t += buf[4];
+ }
+ e = VTIM_mono();
+ printf("%s\n", buf);
+ printf("printf: %fs / %d = %fns - tst val %f\n",
+ e - s, i, 1e9 * (e - s) / i, t);
}
void
More information about the varnish-commit
mailing list