Messages in this thread | | | Date | Fri, 17 Jun 2022 10:59:02 +0200 | Subject | Re: [PATCH v3 03/33] vsprintf: Convert to printbuf | From | Rasmus Villemoes <> |
| |
On 15/06/2022 20.44, Kent Overstreet wrote: > On 6/15/22 05:09, Rasmus Villemoes wrote:
>> Anyway, my main concern with this is that performance goes down the >> drain and the generated code will be awful. Have you done any >> measurements and/or looked at disassembly? Thanks to >> -fno-strict-aliasing (or perhaps just because we're writing through a >> char* pointer which IIRC may alias anything), I think the compiler will >> be forced to reload prt->pos and prt->size over and over and over. I may >> be wrong, of course, that happens often. Perhaps __restrict could >> help, IDK. > > If we care that much about sprintf performance we must have some > benchmarks somewhere - could you point me at them?
Try 'perf top'. Or copy the meat of vsprintf.c (all the %p gunk can be elided) and do some measurements in userspace, that's what I did when I improved the decimal conversion a few years back.
And yes, "we" care about sprintf performance because it's used to generate all those files in /proc, /sys etc. etc. which many tools (e.g. top/ps) rely on.
Rasmus
| |