Commit graph

6 commits

Author SHA1 Message Date
Dave Collins 6c7f45fdb7 Add 2014 to copyright dates. 2014-01-08 23:44:08 -06:00
Dave Collins 497aac6d4a Add new funcs to allow size hints on getdata/inv.
This commit adds two new functions named NewMsgGetDataSizeHint and
NewMsgInvSizeHint.  These are intended to allow callers which know in
advance how large the inventory lists will grow the ability to provides
that information when creating the message.  This in turn provides a
mechanism to avoid the need to perform several grow operations of the
backing array when adding large number of inventory vectors.
2014-01-08 17:21:51 -06:00
Dave Collins 5f971e10e6 Pre-allocate space for slices.
Several of the messages store the parts that have a variable number of
elements as slices.  This commit modifies the code to choose sane defaults
for the backing arrays for the slices so when the entries are actually
appended, a lot of the overhead of growing the backing arrays and copying
the data multiple times is avoided.

Along the same lines, when decoding messages, the actual size is known and
now is pre-allocated instead of dynamically growing the backing array
thereby avoiding some overhead.
2013-09-25 14:38:28 -05:00
Dave Collins e41a3bcaf3 Correct a couple of func prefixes in err messages. 2013-05-10 11:31:06 -05:00
Dave Collins 036f14ff49 Convert MsgInv errors to new MessageError type. 2013-05-10 10:12:45 -05:00
Dave Collins 69b27dd5d3 Initial implementation. 2013-05-08 18:58:29 -05:00