Adaptive heap size (#328)

* heap-size is a CLI arg, make it 512 by default

* Fix tests

* Adaptive heap size.

* Allow storage_exists
This commit is contained in:
Gav Wood
2018-07-16 20:59:10 +02:00
committed by GitHub
parent bb8987df28
commit e75d7d8fda
23 changed files with 360 additions and 137 deletions
+20
View File
@@ -99,6 +99,14 @@ args:
long: execution
value_name: STRATEGY
help: The means of execution used when calling into the runtime. Can be either wasm, native or both.
- min-heap-pages:
long: min-heap-pages
value_name: COUNT
help: The number of 64KB pages to allocate for Wasm execution initially.
- max-heap-pages:
long: max-heap-pages
value_name: COUNT
help: The maximum number of 64KB pages to ever allocate for Wasm execution. Don't alter this unless you know what you're doing.
subcommands:
- build-spec:
about: Build a spec.json file, outputing to stdout
@@ -162,3 +170,15 @@ subcommands:
value_name: PATH
help: Specify custom base path.
takes_value: true
- execution:
long: execution
value_name: STRATEGY
help: The means of execution used when calling into the runtime. Can be either wasm, native or both.
- min-heap-pages:
long: min-heap-pages
value_name: COUNT
help: The number of 64KB pages to allocate for Wasm execution initially.
- max-heap-pages:
long: max-heap-pages
value_name: COUNT
help: The maximum number of 64KB pages to ever allocate for Wasm execution. Don't alter this unless you know what you're doing.
+24
View File
@@ -237,6 +237,13 @@ pub fn run<I, T, W>(args: I, worker: W) -> error::Result<()> where
service::Roles::FULL
};
if let Some(v) = matches.value_of("min-heap-pages") {
config.min_heap_pages = v.parse().map_err(|_| "Invalid --min-heap-pages argument")?;
}
if let Some(v) = matches.value_of("max-heap-pages") {
config.max_heap_pages = v.parse().map_err(|_| "Invalid --max-heap-pages argument")?;
}
if let Some(s) = matches.value_of("execution") {
config.execution_strategy = match s {
"both" => service::ExecutionStrategy::Both,
@@ -393,6 +400,23 @@ fn import_blocks<E>(matches: &clap::ArgMatches, exit: E) -> error::Result<()>
let base_path = base_path(matches);
let mut config = service::Configuration::default_with_spec(spec);
config.database_path = db_path(&base_path, config.chain_spec.id()).to_string_lossy().into();
if let Some(v) = matches.value_of("min-heap-pages") {
config.min_heap_pages = v.parse().map_err(|_| "Invalid --min-heap-pages argument")?;
}
if let Some(v) = matches.value_of("max-heap-pages") {
config.max_heap_pages = v.parse().map_err(|_| "Invalid --max-heap-pages argument")?;
}
if let Some(s) = matches.value_of("execution") {
config.execution_strategy = match s {
"both" => service::ExecutionStrategy::Both,
"native" => service::ExecutionStrategy::NativeWhenPossible,
"wasm" => service::ExecutionStrategy::AlwaysWasm,
_ => return Err(error::ErrorKind::Input("Invalid execution mode specified".to_owned()).into()),
};
}
let client = service::new_client(config)?;
let (exit_send, exit_recv) = std::sync::mpsc::channel();