stampchain-io / btc_stamps

Bitcoin Stamps Indexer
https://stampchain.io
GNU Affero General Public License v3.0
9 stars 2 forks source link

Performance improvements #261

Open reinamora137 opened 1 month ago

reinamora137 commented 1 month ago

py-spy record -o profile.svg -- python start.py

baseline:

image

This is after the logger update optimization profile-post-logger-upd

This is after both optimizations profile

example after updates with many trx in block:

Block: 835230 (1.98s, hashes: L:ceff1 / TX:1cd19 / M:9999c / S:7 / S20:6)
Block: 835231 (1.51s, hashes: L:N/A / TX:147f6 / M:8056f / S:0 / S20:0)
Block: 835232 (3.38s, hashes: L:47aff / TX:349b9 / M:eb2d7 / S:174 / S20:174)
Block: 835233 (2.01s, hashes: L:28748 / TX:fc255 / M:2d396 / S:6 / S20:6)
Block: 835234 (4.13s, hashes: L:0265f / TX:9bd73 / M:d3668 / S:293 / S20:293)
Block: 835235 (6.72s, hashes: L:34d87 / TX:6ce89 / M:1909a / S:527 / S20:527)
Block: 835236 (2.57s, hashes: L:52dfb / TX:840a2 / M:0d0b6 / S:85 / S20:85)
reinamora137 commented 1 month ago

This is the process flow for models.py

image

reinamora137 commented 1 month ago

Entire process flow for reference

out

reinamora137 commented 1 month ago

Always more to improve, but this was the PR for above

https://github.com/stampchain-io/btc_stamps/pull/267