News for hackers. Stuff that matters.
Re:Formatting Text in C++: The Old and the New Ways by xcvb on Sunday September 17, 2023 @03:55AM (#37542595)
I only had a quick look at the code, but it looks like it's timing memory allocation. For example the sprintf part uses std::string str(100, '\0'). I'm not a C++ expert, but I believe this is essentially doing a malloc and memset of 100 bytes for every call to sprintf. So this is probably a poorly setup benchmark.
Re:Formatting Text in C++: The Old and the New Ways by lysium on Sunday September 17, 2023 @04:25AM (#37542764)
I think that might be it. Too bad, the results of this kind of benchmark would have been interesting.