Skip to content

Commit

Permalink
perf: Fix cloning of executor
Browse files Browse the repository at this point in the history
Signed-off-by: Dmitry Murzin <diralik@yandex.ru>
  • Loading branch information
dima74 committed Aug 9, 2024
1 parent 9e8e214 commit 871dbcf
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ eyre = { workspace = true }
futures = { workspace = true, features = ["std", "async-await"] }
parity-scale-codec = { workspace = true, features = ["derive"] }
rand = { workspace = true }
serde = { workspace = true, features = ["derive"] }
serde = { workspace = true, features = ["derive", "rc"] }
serde_json = { workspace = true }
tokio = { workspace = true, features = ["sync", "time", "rt", "io-util", "rt-multi-thread", "macros", "fs"] }
crossbeam-queue = { workspace = true }
Expand Down
8 changes: 6 additions & 2 deletions core/src/executor.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
//! Structures and impls related to *runtime* `Executor`s processing.

use std::sync::Arc;

use derive_more::DebugCustom;
use iroha_data_model::{
account::AccountId,
Expand Down Expand Up @@ -269,7 +271,9 @@ impl Executor {
pub struct LoadedExecutor {
#[serde(skip)]
module: wasmtime::Module,
raw_executor: data_model_executor::Executor,
/// Arc is needed so cloning of executor will be fast.
/// See [`crate::tx::TransactionExecutor::validate_with_runtime_executor`].
raw_executor: Arc<data_model_executor::Executor>,
}

impl LoadedExecutor {
Expand All @@ -279,7 +283,7 @@ impl LoadedExecutor {
) -> Result<Self, wasm::error::Error> {
Ok(Self {
module: wasm::load_module(engine, &raw_executor.wasm)?,
raw_executor,
raw_executor: Arc::new(raw_executor),
})
}
}
Expand Down
Binary file modified defaults/executor.wasm
Binary file not shown.

0 comments on commit 871dbcf

Please sign in to comment.