Branch: refs/heads/master Home: https://github.com/btcsuite/btcd Commit: e7ddaa468e5a699a9c21136e3d453ce38034b98a https://github.com/btcsuite/btcd/commit/e7ddaa468e5a699a9c21136e3d453ce38034b98a Author: Dave Collins <d...@davec.name> Date: 2016-04-25 (Mon, 25 Apr 2016)
Changed paths: M wire/bench_test.go Log Message: ----------- wire: Don't allocate new readers in benchmarks. (#679) This modifies the benchmarks in the wire package to avoid creating a new reader for each iteration. This is useful since it means that showing the memory allocations will only show the function under test instead of the allocation for the benchmark setup as well. The following is a before and after comparison of the allocations with the benchmarks that did not change removed: benchmark old allocs new allocs delta ------------------------------------------------------------ ReadVarInt1 2 1 -50.00% ReadVarInt3 2 1 -50.00% ReadVarInt5 2 1 -50.00% ReadVarInt9 2 1 -50.00% ReadVarStr4 4 3 -25.00% ReadVarStr10 4 3 -25.00% ReadOutPoint 2 1 -50.00% ReadTxOut 4 3 -25.00% ReadTxIn 6 5 -16.67% DeserializeTxSmall 16 15 -6.25% DeserializeTxLarge 33430 33428 -0.01% ReadBlockHeader 8 7 -12.50%