Skip to content

Commit

Permalink
address feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
holykol committed Nov 7, 2023
1 parent 98a35d4 commit aecdcc5
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ colored = "2.0.0"
const-str = "0.5"
derive_more = "0.99.17"
dirs = "4.0.0"
dlmalloc = { git = "https://github.com/gear-tech/dlmalloc-rust.git" }
dlmalloc = { git = "https://github.com/gear-tech/dlmalloc-rust.git", branch = "holykol/free-range-support"}
dyn-clonable = "0.9.0"
enum-iterator = "1.4.0"
env_logger = "0.10"
Expand Down
4 changes: 2 additions & 2 deletions pallets/gear/src/benchmarking/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -827,9 +827,9 @@ benchmarks! {
}

free_range {
let p in 0..512;
let r in 0..512;
let mut res = None;
let exec = Benches::<T>::free_range(p, 1)?;
let exec = Benches::<T>::free_range(r, 1)?;
}: {
res.replace(run_process(exec));
}
Expand Down
6 changes: 2 additions & 4 deletions pallets/gear/src/benchmarking/syscalls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,6 @@ where
pub fn free_range(repetitions: u32, pages_per_call: u32) -> Result<Exec<T>, &'static str> {
use Instruction::*;

const MAX_PAGES_OVERRIDE: u16 = u16::MAX;

let mut instructions = vec![];

for _ in 0..API_BENCHMARK_BATCH_SIZE {
Expand All @@ -277,7 +275,7 @@ where
unreachable_condition(&mut instructions, I32Eq); // if alloc returns -1 then it's error

// free them in steps
let mut i = 1;
let mut i = 0;
for _ in 0..repetitions {
instructions.extend([
I32Const(i),
Expand All @@ -297,7 +295,7 @@ where
..Default::default()
};

Self::prepare_handle_override_max_pages(module, 0, MAX_PAGES_OVERRIDE.into())
Self::prepare_handle(module, 0)
}

pub fn gr_reserve_gas(r: u32) -> Result<Exec<T>, &'static str> {
Expand Down
2 changes: 1 addition & 1 deletion runtime/vara/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ fn page_costs_heuristic_test() {
lazy_pages_signal_write_after_read: 10_650_000.into(),
lazy_pages_host_func_read: 29_000_000.into(),
lazy_pages_host_func_write: 33_000_000.into(),
lazy_pages_host_func_write_after_read: 11_000_000.into(),
lazy_pages_host_func_write_after_read: 9_000_000.into(),
load_page_data: 10_800_000.into(),
upload_page_data: 104_000_000.into(),
static_page: 100.into(),
Expand Down

0 comments on commit aecdcc5

Please sign in to comment.