move last_id age checking into the HashMap

* allows for simpler chaining of banks
  * looks 1.5-2% faster than looping through a VecDequeue

TODO: remove timestamp()?
This commit is contained in:
Rob Walker
2018-10-17 16:28:26 -07:00
parent 0a819ec4e2
commit 76076d6fad
3 changed files with 111 additions and 106 deletions

View File

@@ -5,6 +5,7 @@ extern crate solana;
extern crate test;
use solana::bank::*;
use solana::hash::hash;
use solana::mint::Mint;
use solana::signature::{Keypair, KeypairUtil};
use solana::system_transaction::SystemTransaction;
@@ -40,6 +41,13 @@ fn bench_process_transaction(bencher: &mut Bencher) {
tx
}).collect();
let mut id = bank.last_id();
for _ in 0..(MAX_ENTRY_IDS - 1) {
bank.register_entry_id(&id);
id = hash(&id.as_ref())
}
bencher.iter(|| {
// Since benchmarker runs this multiple times, we need to clear the signatures.
bank.clear_signatures();