eb7bd7b99b
Because `Map` stores elements in arbitrary order, addition of new element takes linear time (`Index` iterates over all keys). Thus our `storageFind` is actually quadratic in time. Optimize this by creating map from sorted slice. ``` name old time/op new time/op delta StorageFind-8 157µs ± 2% 112µs ± 1% -28.60% (p=0.000 n=10+10) name old alloc/op new alloc/op delta StorageFind-8 69.4kB ± 0% 60.5kB ± 0% -12.90% (p=0.000 n=9+10) name old allocs/op new allocs/op delta StorageFind-8 2.21k ± 0% 2.00k ± 0% -9.37% (p=0.000 n=10+7) ``` Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru> |
||
---|---|---|
.. | ||
compiler | ||
config | ||
consensus | ||
core | ||
crypto | ||
encoding | ||
interop | ||
io | ||
network | ||
rpc | ||
services | ||
smartcontract | ||
util | ||
vm | ||
wallet |