diff options
author | Martin Ankerl <martin.ankerl@gmail.com> | 2021-02-14 12:10:15 +0100 |
---|---|---|
committer | Martin Ankerl <martin.ankerl@gmail.com> | 2021-02-16 07:33:55 +0100 |
commit | 74bf850ac47735f2ef4306059d3e664d40cac85e (patch) | |
tree | 50bd032ac0db483949f6731ddb040bce4065af1f /src/torcontrol.h | |
parent | 489030f2a8f89e7ae5031351fc3d0db83e3911ea (diff) | |
download | bitcoin-74bf850ac47735f2ef4306059d3e664d40cac85e.tar.xz |
faster HexStr => 13% faster blockToJSON
`std::string`'s push_back is rather slow because it needs to check & update the string size. For
`HexStr` the output string size is already easily know, so we can initially create the string with
the correct size and then just assign the data.
`HexStr` is heavily usd in `blockToJSON`, so this change is a noticeable benefit. Benchmark on an i7-8700 @3.2GHz:
* 71,315,461.00 ns/op master
* 62,842,490.00 ns/op this commit
So this little change makes `blockToJSON` about ~13% faster.
Diffstat (limited to 'src/torcontrol.h')
0 files changed, 0 insertions, 0 deletions