On 2026-03-11 16:08, Alejandro Colomar wrote:
-  The limits aren't terrible; it's not an order of magnitude.

Yes, I think that's the bottom line. If you use these functions to generate a string, most of your CPU time on practical examples is spent doing memory allocation etc., not in actually generating or measuring the length of the resulting string. So even if the extra strlen costs you 40% more CPU time compared to merely generating the string (a not unreasonable guess for a large string, given your numbers - look at those user times!), it's not that big a deal as the overall performance is worse only somewhere in the 10-20% range.

More generally, these are convenience functions not efficiency functions, so the idea is to not sacrifice convenience for the sake of only 10-20% efficiency gains.

Thanks for doing the measurements.

Reply via email to