mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-02-22 11:18:25 +00:00
3x speedup in snappy compression (#3234)
* 3x speedup in snappy compression oh, the wonders of `copyMem` in `endians2` - speeds up all kinds of operations like database stores, sending gossip etc. * endian usage fixes
This commit is contained in:
parent
e78d12beb9
commit
61b6fc1016
@ -175,7 +175,7 @@ func depositCountU64(s: DepositContractState): uint64 =
|
||||
for i in 0 .. 23:
|
||||
doAssert s.deposit_count[i] == 0
|
||||
|
||||
uint64.fromBytesBE s.deposit_count[24..31]
|
||||
uint64.fromBytesBE s.deposit_count.toOpenArray(24, 31)
|
||||
|
||||
template cfg(m: Eth1Monitor): auto =
|
||||
m.depositsChain.cfg
|
||||
|
@ -384,10 +384,10 @@ proc writeValue*(w: var JsonWriter[RestJson], value: DomainType) {.
|
||||
|
||||
proc readValue*(reader: var JsonReader[RestJson], value: var DomainType) {.
|
||||
raises: [IOError, SerializationError, Defect].} =
|
||||
var data: array[4, byte]
|
||||
try:
|
||||
hexToByteArray(reader.readValue(string), data)
|
||||
let res = uint32.fromBytesLE(data)
|
||||
let
|
||||
data = hexToByteArray(reader.readValue(string), 4)
|
||||
res = uint32.fromBytesLE(data)
|
||||
if res >= uint32(low(DomainType)) and res <= uint32(high(DomainType)):
|
||||
value = cast[DomainType](res)
|
||||
else:
|
||||
|
2
vendor/nim-snappy
vendored
2
vendor/nim-snappy
vendored
@ -1 +1 @@
|
||||
Subproject commit 16cce7d07ce8be2cfc760d86744b8b54cd0808a9
|
||||
Subproject commit 2256d6efb266dd1f65fc24077fb148377edb5b8c
|
2
vendor/nim-stew
vendored
2
vendor/nim-stew
vendored
@ -1 +1 @@
|
||||
Subproject commit 2f9c61f485e1de6d7e163294008276c455d39da2
|
||||
Subproject commit 543c7edbc710a3f9d329e094499159a315ee4905
|
Loading…
x
Reference in New Issue
Block a user