[6.1] 208583f38 trivial vtim printf benchmark
hermunn
hermunn at varnish-software.com
Wed Oct 24 09:29:20 UTC 2018
commit 208583f389d14de6b15a00a315d26cb66c4c844b
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