lbcd/database/ldb
Dave Collins f5cdf2d6a8 Minor hashing-related optimizations.
This commit contains three classes of optimizations:
 - Reducing the number of unnecessary hash copies
 - Improve the performance of the DoubleSha256 function
 - A couple of minor optimizations of the ShaHash functions

The first class is a result of the Bytes function on a ShaHash making a
copy of the bytes before returning them.  It really should have been named
CloneBytes, but that would break the API now.

To address this, a comment has been added to the function which explicitly
calls out the copy behavior.  In addition, all call sites of .Bytes on a
ShaHash in the code base have been updated to simply slice the array when
a copy is not needed.  This saves a significant amount of data copying.

The second optimization modifies the DoubleSha256 function to directly use
fastsha256.Sum256 instead of the hasher interface.  This reduces the
number of allocations needed.  A benchmark for the function has been added
as well.

old: BenchmarkDoubleSha256  500000   3691 ns/op   192 B/op   3 allocs/op
new: BenchmarkDoubleSha256  500000   3081 ns/op    32 B/op   1 allocs/op

The final optimizations are for the ShaHash IsEqual and SetBytes functions
which have been modified to make use of the fact the type is an array and
remove an unneeded subslice.
2015-04-06 11:33:58 -05:00
..
dbtest Import btcdb repo into database directory. 2015-01-27 13:15:15 -06:00
block.go Minor hashing-related optimizations. 2015-04-06 11:33:58 -05:00
boundary_test.go Update btcwire path import paths to new location. 2015-02-05 15:16:39 -06:00
doc.go Import btcdb repo into database directory. 2015-01-27 13:15:15 -06:00
dup_test.go Update btcwire path import paths to new location. 2015-02-05 15:16:39 -06:00
insertremove_test.go Update btcwire path import paths to new location. 2015-02-05 15:16:39 -06:00
internal_test.go Fix #303 and #346 and change addrindex sort order 2015-03-23 13:05:54 -04:00
leveldb.go Minor hashing-related optimizations. 2015-04-06 11:33:58 -05:00
operational_test.go Update golang.org/x/crypto import paths to new location. 2015-03-03 21:10:38 -06:00
tx.go Minor hashing-related optimizations. 2015-04-06 11:33:58 -05:00