0
0
Fork 0
mirror of https://github.com/denoland/rusty_v8.git synced 2025-03-10 14:06:53 -04:00
rusty-v8/tests/test_concurrent_isolate_creation_and_disposal.rs
Yuri Astrakhan 7b0ee753ff
chore: cleanup format args (#1688)
* chore: cleanup format args

Apply [`uninlined_format_args`](https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args) clippy lint -- makes code a bit more readable.

* chore: cleanup format args

Manually clean up [`uninlined_format_args`](https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args) clippy lint.  Some of these changes cause about 5% performance improvements because `format!("{}", &var)` does not need a reference and cannot be optimized by the compiler (but in thees cases the perf difference is less important)
2025-02-10 10:58:00 -08:00

32 lines
732 B
Rust

// This is flaky on cross (QEMU bug)
// but otherwise works fine on real device.
#![cfg(not(target_arch = "aarch64"))]
use std::iter::repeat_with;
use std::thread;
#[test]
fn concurrent_isolate_creation_and_disposal() {
let platform = v8::new_single_threaded_default_platform(false).make_shared();
v8::V8::initialize_platform(platform);
v8::V8::initialize();
for round in 0..1000 {
eprintln!("round {round}");
let threads = repeat_with(|| {
thread::spawn(|| {
v8::Isolate::new(Default::default());
})
})
.take(16)
.collect::<Vec<_>>();
for join_handle in threads {
join_handle.join().unwrap();
}
}
unsafe { v8::V8::dispose() };
v8::V8::dispose_platform();
}