Skip to content

Commit 4855758

Browse files
committed
Fix benchmark temp dirs clippy lint
1 parent 9183a7d commit 4855758

File tree

4 files changed

+99
-58
lines changed

4 files changed

+99
-58
lines changed

packages/vm/benches/main.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,9 @@ fn bench_instance(c: &mut Criterion) {
182182
fn bench_cache(c: &mut Criterion) {
183183
let mut group = c.benchmark_group("Cache");
184184

185+
let temp_dir = TempDir::new().unwrap();
185186
let options = CacheOptions::new(
186-
TempDir::new().unwrap().into_path(),
187+
temp_dir.path(),
187188
capabilities_from_csv(DEFAULT_CAPABILITIES),
188189
MEMORY_CACHE_SIZE,
189190
DEFAULT_MEMORY_LIMIT,
@@ -237,9 +238,10 @@ fn bench_cache(c: &mut Criterion) {
237238
});
238239
}
239240

241+
let temp_dir = TempDir::new().unwrap();
240242
group.bench_function("instantiate from fs", |b| {
241243
let non_memcache = CacheOptions::new(
242-
TempDir::new().unwrap().into_path(),
244+
temp_dir.path(),
243245
capabilities_from_csv(DEFAULT_CAPABILITIES),
244246
Size::new(0),
245247
DEFAULT_MEMORY_LIMIT,
@@ -259,9 +261,10 @@ fn bench_cache(c: &mut Criterion) {
259261
});
260262
});
261263

264+
let temp_dir = TempDir::new().unwrap();
262265
group.bench_function("instantiate from fs unchecked", |b| {
263266
let non_memcache = CacheOptions::new(
264-
TempDir::new().unwrap().into_path(),
267+
temp_dir.path(),
265268
capabilities_from_csv(DEFAULT_CAPABILITIES),
266269
Size::new(0),
267270
DEFAULT_MEMORY_LIMIT,
@@ -326,9 +329,10 @@ fn bench_cache(c: &mut Criterion) {
326329
}
327330

328331
fn bench_instance_threads(c: &mut Criterion) {
332+
let temp_dir = TempDir::new().unwrap();
329333
c.bench_function("multi-threaded get_instance", |b| {
330334
let options = CacheOptions::new(
331-
TempDir::new().unwrap().into_path(),
335+
temp_dir.path(),
332336
capabilities_from_csv(DEFAULT_CAPABILITIES),
333337
MEMORY_CACHE_SIZE,
334338
DEFAULT_MEMORY_LIMIT,
@@ -413,8 +417,9 @@ fn bench_instance_threads(c: &mut Criterion) {
413417
fn bench_combined(c: &mut Criterion) {
414418
let mut group = c.benchmark_group("Combined");
415419

420+
let temp_dir = TempDir::new().unwrap();
416421
let options = CacheOptions::new(
417-
TempDir::new().unwrap().into_path(),
422+
temp_dir.path(),
418423
capabilities_from_csv("cosmwasm_1_1,cosmwasm_1_2,cosmwasm_1_3,iterator,staking"),
419424
MEMORY_CACHE_SIZE,
420425
DEFAULT_MEMORY_LIMIT,

packages/vm/examples/heap_profiling.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,9 @@ fn contracts() -> Vec<Contract> {
104104
fn app(runtime: u64) {
105105
let start_time = SystemTime::now();
106106

107+
let temp_dir = TempDir::new().unwrap();
107108
let options = CacheOptions::new(
108-
TempDir::new().unwrap().into_path(),
109+
temp_dir.path(),
109110
capabilities_from_csv("iterator,staking,stargate,cosmwasm_1_1,cosmwasm_1_2,cosmwasm_1_3,cosmwasm_1_4,cosmwasm_2_0,cosmwasm_2_1"),
110111
MEMORY_CACHE_SIZE,
111112
DEFAULT_MEMORY_LIMIT,

packages/vm/examples/multi_threaded_cache.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ const INSTANTIATION_THREADS: usize = 2048;
2525
const THREADS: usize = STORE_CODE_THREADS + INSTANTIATION_THREADS;
2626

2727
pub fn main() {
28+
let temp_dir = TempDir::new().unwrap();
2829
let options = CacheOptions::new(
29-
TempDir::new().unwrap().into_path(),
30+
temp_dir.path(),
3031
capabilities_from_csv("iterator,staking,cosmwasm_1_1,cosmwasm_1_2,cosmwasm_1_3,cosmwasm_1_4,cosmwasm_2_0,cosmwasm_2_1,cosmwasm_2_2"),
3132
MEMORY_CACHE_SIZE,
3233
DEFAULT_MEMORY_LIMIT,

0 commit comments

Comments
 (0)