Commit a289b619 authored by Nils Goroll's avatar Nils Goroll

add phk's suggestion to the micro-benchmark

parent a2d0b594
......@@ -537,9 +537,20 @@ bench()
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);
printf("printf %%.6f: %fs / %d = %fns - tst val %f %s\n",
e - s, i, 1e9 * (e - s) / i, t, buf);
t = 0;
s = VTIM_mono();
for (i=0; i<100000; i++) {
snprintf(buf, sizeof(buf), "%ju.%06ju",
(uint64_t)floor(s),
(uint64_t)floor((s * 1e6)) % 1000000UL);
t += buf[4];
}
e = VTIM_mono();
printf("printf %%ju.%%06ju: %fs / %d = %fns - tst val %f %s\n",
e - s, i, 1e9 * (e - s) / i, t, buf);
}
void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment