-
Notifications
You must be signed in to change notification settings - Fork 1k
Tracking/limiting memory allocator #1192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
47ecf58
58330de
aac1da6
99d4f5e
18ef342
facd26a
3d2146a
6ee5ff3
f85c753
c9c0bf8
edfa2e1
ac5dab4
994273a
72ded39
dfa0daf
e740b5c
48cde3e
acf149e
6cfeceb
c7fa464
edeb901
251ac90
4195806
09e5c07
02ad536
e1a2b63
1918d2a
b06cb6d
39cf3b7
007054a
c81e8aa
5920260
a37c688
96d71c9
30e5236
73799fb
93b9d61
8485741
7a3875a
83e6b99
6c6afc8
9de0856
d6470c5
d2d8a60
d74aa20
fb40a0d
9c1d920
c6be92b
8c58a68
52578ee
778513c
9c3ea9b
54686a1
07eb6a9
e3ca3b6
8be6359
8b0a722
331ed01
7d69a9b
10e7443
c3b66f2
e94ddf9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
// Copyright (C) Parity Technologies (UK) Ltd. | ||
// This file is part of Polkadot. | ||
|
||
// Polkadot is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
|
||
// Polkadot is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
|
||
// You should have received a copy of the GNU General Public License | ||
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
use criterion::{criterion_group, criterion_main, Criterion, SamplingMode}; | ||
use polkadot_node_core_pvf_common::{ | ||
executor_intf::{prepare, prevalidate}, | ||
prepare::PrepareJobKind, | ||
pvf::PvfPrepData, | ||
}; | ||
use polkadot_primitives::ExecutorParams; | ||
use std::time::Duration; | ||
|
||
fn do_prepare_runtime(pvf: PvfPrepData) { | ||
let blob = match prevalidate(&pvf.code()) { | ||
Err(err) => panic!("{:?}", err), | ||
Ok(b) => b, | ||
}; | ||
|
||
match prepare(blob, &pvf.executor_params()) { | ||
Ok(_) => (), | ||
Err(err) => panic!("{:?}", err), | ||
} | ||
} | ||
|
||
fn prepare_rococo_runtime(c: &mut Criterion) { | ||
let blob = rococo_runtime::WASM_BINARY.unwrap(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: Use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But it's not a parachain runtime, it's Rococo runtime itself 🙂 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I mean, we're preparing something that doesn't export There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, that's right. But for preparation benchmarking, it's better to use code similar to a real-life parachain code by its volume, and there's nothing suitable at hand. All the test parachains are too simple. So, as we're not going to execute it anyway, I decided to use Rococo. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, makes sense. On the other hand, the bench could break if we ever switch to your custom compiler. FWIU, it will either only support compiling PVFs, or at least be optimized specifically for them. Something to keep in mind at least. |
||
let pvf = match sp_maybe_compressed_blob::decompress(&blob, 64 * 1024 * 1024) { | ||
Ok(code) => PvfPrepData::from_code( | ||
code.into_owned(), | ||
ExecutorParams::default(), | ||
Duration::from_secs(360), | ||
PrepareJobKind::Compilation, | ||
), | ||
Err(e) => { | ||
panic!("Cannot decompress blob: {:?}", e); | ||
}, | ||
}; | ||
|
||
let mut group = c.benchmark_group("rococo"); | ||
group.sampling_mode(SamplingMode::Flat); | ||
group.sample_size(20); | ||
group.measurement_time(Duration::from_secs(240)); | ||
group.bench_function("prepare Rococo runtime", |b| { | ||
// `PvfPrepData` is designed to be cheap to clone, so cloning shouldn't affect the | ||
// benchmark accuracy | ||
b.iter(|| do_prepare_runtime(pvf.clone())) | ||
}); | ||
group.finish(); | ||
} | ||
|
||
criterion_group!(preparation, prepare_rococo_runtime); | ||
criterion_main!(preparation); |
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.