Browse Source

storage: speed up write() by using faster compression setting

Re total runtime of WalletDB.write() and file size on disk,
for a large encrypted wallet, compare:

before (zlib level=6):
file size 16_670 KB
JsonDB.dump 0.5099 sec
zlib.compress 1.3280 sec
ECPubkey.encrypt_message 0.1720 sec

after change (zlib level=1):
file size 17_527 KB
JsonDB.dump 0.5344 sec
zlib.compress 0.5320 sec
ECPubkey.encrypt_message 0.1837 sec
patch-4
SomberNight 4 years ago
parent
commit
d86138a1a5
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 2
      electrum/storage.py

2
electrum/storage.py

@ -176,7 +176,7 @@ class WalletStorage(Logger):
s = plaintext
if self.pubkey:
s = bytes(s, 'utf8')
c = zlib.compress(s)
c = zlib.compress(s, level=zlib.Z_BEST_SPEED)
enc_magic = self._get_encryption_magic()
public_key = ecc.ECPubkey(bfh(self.pubkey))
s = public_key.encrypt_message(c, enc_magic)

Loading…
Cancel
Save