3 ms·
I gave a time in my original post: 1-2usec. Printing a handful of doubles with a cold instruction cache using the standard stdio headers takes longer than that
by CoolGuySteve 6y ago
I gave a time in my original post: 1-2usec. Printing a handful of doubles with a cold instruction cache using the standard stdio headers takes longer than that due to all the special casing.
klodolph made some handwavey claim about synchronization overhead that are clearly false. It doesn't even make sense to me since the device being printed to will need some sort of synchronization and syscall.
Both you and klodlph are also making handwavey claims about formatting speed in Linux.
You both need to measure before you argue. I find it extremely rude to argue from a position of ignorance as both of you are doing.
"Well gee, I dunno but you're probably wrong". It's so asinine.
- klodolph 6y agoSure, if you have a cold instruction cache. If stdio is not in your instruction cache, or at least in L2, then you’re not using it very much, and you won’t get much benefit from moving it to a different thread. My measurements put stdio formatting at around 100ns for the typical messages I’m printing. So, offloading it to another thread is a fairly clear loss. Even for floating point numbers, you’ll hit the fast path with fairly high regularity. My measurements put it at around 80ns for a double, on my system, most of the time.