mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 08:51:09 +00:00
Switch to pooling copy-on-write instantiation strategy for WASM (#11232)
* Switch to pooling copy-on-write instantiation strategy for WASM * Fix benchmark compilation * Fix `cargo fmt` * Fix compilation of another benchmark I've missed * Cleanups according to review comments * Move `max_memory_size` to `Semantics` * Set `memory_guaranteed_dense_image_size` to `max_memory_size` * Rename `wasm_instantiation_strategy` to `wasmtime_instantiation_strategy` * Update the doc-comments regarding the instantiation strategy * Extend the integration tests to test every instantiation strategy * Don't drop the temporary directory until the runtime is dropped in benchmarks * Don't drop the temporary directory until the runtime is dropped in tests
This commit is contained in:
@@ -29,7 +29,7 @@ use sc_consensus::{
|
||||
use sc_service::{
|
||||
config::{
|
||||
DatabaseSource, KeepBlocks, KeystoreConfig, NetworkConfiguration, OffchainWorkerConfig,
|
||||
PruningMode, WasmExecutionMethod,
|
||||
PruningMode, WasmExecutionMethod, WasmtimeInstantiationStrategy,
|
||||
},
|
||||
BasePath, Configuration, Role,
|
||||
};
|
||||
@@ -77,7 +77,9 @@ fn new_node(tokio_handle: Handle) -> node_cli::service::NewFullBase {
|
||||
state_pruning: Some(PruningMode::ArchiveAll),
|
||||
keep_blocks: KeepBlocks::All,
|
||||
chain_spec: spec,
|
||||
wasm_method: WasmExecutionMethod::Compiled,
|
||||
wasm_method: WasmExecutionMethod::Compiled {
|
||||
instantiation_strategy: WasmtimeInstantiationStrategy::PoolingCopyOnWrite,
|
||||
},
|
||||
execution_strategies: ExecutionStrategies {
|
||||
syncing: execution_strategy,
|
||||
importing: execution_strategy,
|
||||
|
||||
@@ -25,6 +25,8 @@ use node_runtime::{
|
||||
UncheckedExtrinsic,
|
||||
};
|
||||
use node_testing::keyring::*;
|
||||
#[cfg(feature = "wasmtime")]
|
||||
use sc_executor::WasmtimeInstantiationStrategy;
|
||||
use sc_executor::{Externalities, NativeElseWasmExecutor, RuntimeVersionOf, WasmExecutionMethod};
|
||||
use sp_core::{
|
||||
storage::well_known_keys,
|
||||
@@ -183,7 +185,9 @@ fn bench_execute_block(c: &mut Criterion) {
|
||||
ExecutionMethod::Native,
|
||||
ExecutionMethod::Wasm(WasmExecutionMethod::Interpreted),
|
||||
#[cfg(feature = "wasmtime")]
|
||||
ExecutionMethod::Wasm(WasmExecutionMethod::Compiled),
|
||||
ExecutionMethod::Wasm(WasmExecutionMethod::Compiled {
|
||||
instantiation_strategy: WasmtimeInstantiationStrategy::PoolingCopyOnWrite,
|
||||
}),
|
||||
];
|
||||
|
||||
for strategy in execution_methods {
|
||||
|
||||
@@ -46,7 +46,7 @@ use sc_client_api::{
|
||||
};
|
||||
use sc_client_db::PruningMode;
|
||||
use sc_consensus::{BlockImport, BlockImportParams, ForkChoiceStrategy, ImportResult, ImportedAux};
|
||||
use sc_executor::{NativeElseWasmExecutor, WasmExecutionMethod};
|
||||
use sc_executor::{NativeElseWasmExecutor, WasmExecutionMethod, WasmtimeInstantiationStrategy};
|
||||
use sp_api::ProvideRuntimeApi;
|
||||
use sp_block_builder::BlockBuilder;
|
||||
use sp_consensus::BlockOrigin;
|
||||
@@ -398,7 +398,14 @@ impl BenchDb {
|
||||
let backend = sc_service::new_db_backend(db_config).expect("Should not fail");
|
||||
let client = sc_service::new_client(
|
||||
backend.clone(),
|
||||
NativeElseWasmExecutor::new(WasmExecutionMethod::Compiled, None, 8, 2),
|
||||
NativeElseWasmExecutor::new(
|
||||
WasmExecutionMethod::Compiled {
|
||||
instantiation_strategy: WasmtimeInstantiationStrategy::PoolingCopyOnWrite,
|
||||
},
|
||||
None,
|
||||
8,
|
||||
2,
|
||||
),
|
||||
&keyring.generate_genesis(),
|
||||
None,
|
||||
None,
|
||||
|
||||
Reference in New Issue
Block a user