Skip to content

Commit

Permalink
Revert: deserialize stored transactions in a rayon thread (#4933)
Browse files Browse the repository at this point in the history
* Revert: deserialize stored transactions in a rayon thread

* Add a TODO for the reverted bug fix

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
teor2345 and mergify[bot] authored Aug 30, 2022
1 parent c85e482 commit c188678
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions zebra-state/src/service/finalized_state/disk_format/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,21 +231,12 @@ impl FromDisk for Transaction {
fn from_bytes(bytes: impl AsRef<[u8]>) -> Self {
let bytes = bytes.as_ref();

let mut tx = None;

// # Performance
//
// Move CPU-intensive deserialization cryptography into the rayon thread pool.
// This avoids blocking the tokio executor.
rayon::in_place_scope_fifo(|scope| {
scope.spawn_fifo(|_scope| {
tx = Some(bytes.as_ref().zcash_deserialize_into().expect(
"deserialization format should match the serialization format used by IntoDisk",
));
});
});

tx.expect("scope has already run")
// TODO: skip cryptography verification during transaction deserialization from storage,
// or do it in a rayon thread (ideally in parallel with other transactions)
bytes
.as_ref()
.zcash_deserialize_into()
.expect("deserialization format should match the serialization format used by IntoDisk")
}
}

Expand Down

0 comments on commit c188678

Please sign in to comment.