spaceStr in univalue_write.cpp is not thread-safe #4756

issue sipa opened this issue on August 23, 2014
  1. sipa commented at 11:22 AM on August 23, 2014: member

    indentStr increases spaceStr as-needed, which is not thread safe. Just initializating it once to some reasonable maximum seems better.

  2. sipa assigned jgarzik on Aug 23, 2014
  3. laanwj added the label Priority Low on Aug 26, 2014
  4. laanwj added the label Bug on Aug 26, 2014
  5. laanwj referenced this in commit 92a75339e2 on Sep 5, 2014
  6. 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.

  7. laanwj referenced this in commit 41ef558aa9 on Sep 5, 2014
  8. sipa closed this on Sep 6, 2014

  9. reddink referenced this in commit 71445aef9e on May 27, 2020
  10. DrahtBot locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-13 18:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me