One less alloc per transaction (#9705)

* One less alloc per transaction

* Fix benches

* Fix compiler warnings in bench build

* Fix move build

* Fix bench
This commit is contained in:
Greg Fitzgerald
2020-04-24 13:03:46 -06:00
committed by GitHub
parent 767a0f9384
commit 76b1c2baf0
24 changed files with 95 additions and 106 deletions

View File

@@ -823,7 +823,7 @@ impl ReplayStage {
vote,
);
let mut vote_tx = Transaction::new_with_payer(vec![vote_ix], Some(&node_keypair.pubkey()));
let mut vote_tx = Transaction::new_with_payer(&[vote_ix], Some(&node_keypair.pubkey()));
let blockhash = bank.last_blockhash();
vote_tx.partial_sign(&[node_keypair.as_ref()], blockhash);

View File

@@ -1506,7 +1506,7 @@ pub mod tests {
);
let vote_tx = Transaction::new_signed_instructions(
&[&leader_vote_keypair],
vec![vote_ix],
&[vote_ix],
Hash::default(),
);
let shreds = entries_to_test_shreds(
@@ -2777,7 +2777,7 @@ pub mod tests {
let transaction = Transaction::new_signed_instructions(
&[&alice, &alice_vote_keypair],
instructions,
&instructions,
bank.last_blockhash(),
);
bank.process_transaction(&transaction)
@@ -2807,7 +2807,7 @@ pub mod tests {
bank.freeze();
// Votes
let instructions = vec![
let instructions = [
vote_instruction::vote(
&leader_vote_keypair.pubkey(),
&leader_vote_keypair.pubkey(),
@@ -2835,7 +2835,7 @@ pub mod tests {
));
let transaction = Transaction::new_signed_with_payer(
instructions,
&instructions,
Some(&alice.pubkey()),
&[&alice, &leader_vote_keypair, &alice_vote_keypair],
bank.last_blockhash(),

View File

@@ -527,7 +527,7 @@ mod tests {
);
let tx = Transaction::new_signed_instructions(
&[&contract_funds, &contract_state],
ixs,
&ixs,
blockhash,
);
process_transaction_and_notify(&bank_forks, &tx, &rpc.subscriptions).unwrap();
@@ -571,7 +571,7 @@ mod tests {
&contract_state.pubkey(),
&bob_pubkey,
);
let tx = Transaction::new_signed_instructions(&[&witness], vec![ix], blockhash);
let tx = Transaction::new_signed_instructions(&[&witness], &[ix], blockhash);
process_transaction_and_notify(&bank_forks, &tx, &rpc.subscriptions).unwrap();
sleep(Duration::from_millis(200));