indentStr increases spaceStr as-needed, which is not thread safe. Just initializating it once to some reasonable maximum seems better.
spaceStr in univalue_write.cpp is not thread-safe #4756
issue sipa opened this issue on August 23, 2014-
sipa commented at 11:22 AM on August 23, 2014: member
- sipa assigned jgarzik on Aug 23, 2014
- laanwj added the label Priority Low on Aug 26, 2014
- laanwj added the label Bug on Aug 26, 2014
- laanwj referenced this in commit 92a75339e2 on Sep 5, 2014
-
laanwj commented at 11:13 AM on September 5, 2014: member
This looks like premature optimization to me. But even then, any concrete indication that just generating a string of spaces is slower than copying it? My gut feeling would be that it is faster to generate them, as there is less memory access in that case.
I'd say it would be better to not create a temporary string at all. See #4851.
- laanwj referenced this in commit 41ef558aa9 on Sep 5, 2014
- sipa closed this on Sep 6, 2014
- reddink referenced this in commit 71445aef9e on May 27, 2020
- DrahtBot locked this on Sep 8, 2021