Branch: refs/heads/master
  Home:   https://github.com/conformal/btcd
  Commit: f88db561f1369ab07d6596b0a3852165544249da
      
https://github.com/conformal/btcd/commit/f88db561f1369ab07d6596b0a3852165544249da
  Author: Josh Rickmar <[email protected]>
  Date:   2014-04-20 (Sun, 20 Apr 2014)

  Changed paths:
    M rpcwebsocket.go

  Log Message:
  -----------
  Make rescan faster by avoiding hash copies.

Copying the RIPEMD160 after SHA256 hash result into a new stack array
to be used as a map lookup key can be quite expensive, and this should
be avoided if possible on intensive tasks such as rescans.  This
change takes advantage of the new Hash160 methods of the
AddressPubKeyHash and AddressScriptHash types to use the address's
underlying hash array directly, rather than creating a copy from the
ScriptAddress result.

Unfortunately, for AddressPubKey, ScriptAddress may return either a
byte slice of len 33 or 65 depending on whether the pubkey is
compressed or not, so no such straightforward optimization is
possible.

As a result of this change, I have seen rescans perform roughly 3.5x
faster than before.


Reply via email to