neoneo-go/pkg/encoding/bigint
Roman Khimov 9a06995460 bigint: don't allocate in ToPreallocatedBytes
Turns out, it's almost always allocating because we're mostly dealing with
small integers while the buffer size is calculated in 8-byte chunks here, so
preallocated buffer is always insufficient.

name                   old time/op    new time/op    delta
ToPreallocatedBytes-8    28.5ns ± 7%    19.7ns ± 5%   -30.72%  (p=0.000 n=10+10)

name                   old alloc/op   new alloc/op   delta
ToPreallocatedBytes-8     16.0B ± 0%      0.0B       -100.00%  (p=0.000 n=10+10)

name                   old allocs/op  new allocs/op  delta
ToPreallocatedBytes-8      1.00 ± 0%      0.00       -100.00%  (p=0.000 n=10+10)

Fix StorageItem reuse at the same time. We don't copy when getting values from
the storage, but we don when we're putting them, so buffer reuse could corrupt
old values.
2022-06-02 15:38:39 +03:00
..
bench_test.go bigint: don't allocate in ToPreallocatedBytes 2022-06-02 15:38:39 +03:00
bigint.go bigint: don't allocate in ToPreallocatedBytes 2022-06-02 15:38:39 +03:00
bigint_test.go util: move ArrayReverse into package of its own 2021-07-19 22:57:55 +03:00
doc.go *: add more package-specific documentation 2021-03-19 16:18:45 +03:00