Make GetAvailableCredit run GetHash() only once per transaction. #3973

pull gmaxwell wants to merge 1 commits into bitcoin:master from gmaxwell:getavailfast changing 1 files +2 −1
  1. gmaxwell commented at 5:02 PM on March 28, 2014: contributor

    This makes the first getbalance/getinfo 63x faster on my wallet.

  2. Make GetAvailableCredit run GetHash() only once per transaction.
    This makes the first getbalance/getinfo 63x faster on my wallet.
    a60ab0ba89
  3. gmaxwell commented at 5:04 PM on March 28, 2014: contributor

    Putting this up so other people complaining about slow getinfo can try it. I'd like to better understand exactly why it was taking 12.6 seconds for me in the first place, as it's a bit surprising that computing the transaction hashes would be that slow.

  4. BitcoinPullTester commented at 5:21 PM on March 28, 2014: none

    Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/a60ab0ba89289433563c4c0993904acbca8c99ff for binaries and test log. This test script verifies pulls every time they are updated. It, however, dies sometimes and fails to test properly. If you are waiting on a test, please check timestamps to verify that the test.log is moving at http://jenkins.bluematt.me/pull-tester/current/ Contact BlueMatt on freenode if something looks broken.

  5. gavinandresen commented at 6:44 PM on March 28, 2014: contributor

    ACK on the change.

  6. laanwj commented at 4:48 AM on March 29, 2014: member

    ACK on the change.

    Though a more general solution would be to store re-compute the transaction hash only on changes to a transaction. GetHash() is called a lot also in other contexts, if it is really this slow that may make sense.

  7. gmaxwell commented at 4:54 AM on March 29, 2014: contributor

    From looking at the behavior we seem to be wasting just a ton of time in serialization code (and associated memory allocation) when computing GetHash... there is probably a lot of general room for improvement there, though regardless not calling it extra times is probably go no matter how much we improve it. Sounds like other people are reporting it solved their issues.

  8. laanwj referenced this in commit 55027a8c85 on Mar 29, 2014
  9. laanwj merged this on Mar 29, 2014
  10. laanwj closed this on Mar 29, 2014

  11. 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-15 18:16 UTC

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