HomePhabricator

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

Description

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

Summary:
Original commit message:

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

My own test confirms the gain in speed when writing an encrypted wallet file to disk.

Before:

file size: 959K

pierre@simak:~/dev/bitcoin-abc/electrum$ ./electrum-abc -v
|  7.516| |04| [profiler] WalletStorage.write 0.0644
| 16.291| |00| [profiler] WalletStorage.write 0.0682

After:

file size: 1018K (6% increase)

pierre@simak:~/dev/bitcoin-abc/electrum$ ./electrum-abc -v
|  9.092| |04| [profiler] WalletStorage.write 0.0343
| 17.637| |00| [profiler] WalletStorage.write 0.0399

Depends on D14234
This is a backport of https://github.com/spesmilo/electrum/commit/d86138a1a5a144b5adc32ef8bd1ff7afd860927d

Test Plan:
python test_runner.py

Profiling (see Summary) and testing the application.

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D14235

Details

Provenance
PiRKAuthored on Jul 9 2023, 08:25
PiRKPushed on Jul 10 2023, 05:27
Reviewer
Restricted Project
Differential Revision
D14235: [electrum] storage: speed up write() by using faster compression setting
Parents
rABC74686a0b4c73: [electrum] write compact JSON for unencrypted wallet files
Branches
Unknown
Tags
Unknown