Browse Source

A couple more tweaks.

master
Neil Booth 8 years ago
parent
commit
f02acdfd46
  1. 3
      PERFORMANCE-NOTES
  2. 6
      server/block_processor.py

3
PERFORMANCE-NOTES

@ -5,6 +5,9 @@ account in the code.
or lists with tuple(), list(). Of those list is 10% faster than
tuple.
- however when not initializing from a generator, a fixed-length tuple
is at least 80% faster than a list.
- an implicit default argument is ~5% faster than passing the default
explicitly

6
server/block_processor.py

@ -211,8 +211,8 @@ class MemPool(LoggedClass):
return (script_hash168(txout.pk_script), txout.value)
for hex_hash, tx in new_txs.items():
txout_pairs = tuple(txout_pair(txout) for txout in tx.outputs)
self.txs[hex_hash] = [None, txout_pairs, None]
txout_pairs = [txout_pair(txout) for txout in tx.outputs]
self.txs[hex_hash] = (None, txout_pairs, None)
def txin_info(txin):
hex_hash = hash_to_str(txin.prev_hash)
@ -239,7 +239,7 @@ class MemPool(LoggedClass):
# If we were missing a UTXO for some reason drop this tx
del self.txs[hex_hash]
continue
self.txs[hex_hash] = [txin_pairs, txout_pairs, any(unconfs)]
self.txs[hex_hash] = (txin_pairs, txout_pairs, any(unconfs))
# Update touched and self.hash168s for the new tx
for hash168, value in txin_pairs:

Loading…
Cancel
Save