Branch: refs/heads/master
  Home:   https://github.com/conformal/btcwire
  Commit: 26cb71d805c1d80ba0b3eba35fea967c9c282282
      
https://github.com/conformal/btcwire/commit/26cb71d805c1d80ba0b3eba35fea967c9c282282
  Author: Dave Collins <[email protected]>
  Date:   2013-10-30 (Wed, 30 Oct 2013)

  Changed paths:
    M common.go
    M msgtx.go

  Log Message:
  -----------
  Expose new SerializeSize API for transactions.

This commit adds a new function named SerializeSize to the public API for
MsgTx, TxOut, and TxIn which can be used to determine how many bytes the
serialized data would take without having to actually serialize it.

The following benchmark shows the difference between using the new
function to get the serialize size for a typical transaction and
serializing into a temporary buffer and taking the length of it:

Bufffer: BenchmarkTxSerializeSizeBuffer     200000           7050 ns/op
New:     BenchmarkTxSerializeSizeNew     100000000             18 ns/op

This is part of the ongoing effort to optimize serialization as noted in
conformal/btcd#27.



Reply via email to