mirror of
https://github.com/denoland/deno.git
synced 2025-01-21 21:50:00 -05:00
chore(cli): remove unnecessary unsafe in bench (#15000)
This commit is contained in:
parent
76d387fb93
commit
91570ba6e8
1 changed files with 5 additions and 12 deletions
|
@ -1,9 +1,9 @@
|
||||||
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
|
||||||
|
|
||||||
use super::Result;
|
use super::Result;
|
||||||
|
use std::sync::atomic::{AtomicU16, Ordering};
|
||||||
use std::{collections::HashMap, path::Path, process::Command, time::Duration};
|
use std::{collections::HashMap, path::Path, process::Command, time::Duration};
|
||||||
pub use test_util::{parse_wrk_output, WrkOutput as HttpBenchmarkResult};
|
pub use test_util::{parse_wrk_output, WrkOutput as HttpBenchmarkResult};
|
||||||
|
|
||||||
// Some of the benchmarks in this file have been renamed. In case the history
|
// Some of the benchmarks in this file have been renamed. In case the history
|
||||||
// somehow gets messed up:
|
// somehow gets messed up:
|
||||||
// "node_http" was once called "node"
|
// "node_http" was once called "node"
|
||||||
|
@ -150,18 +150,11 @@ fn run(
|
||||||
Ok(parse_wrk_output(&output))
|
Ok(parse_wrk_output(&output))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static NEXT_PORT: AtomicU16 = AtomicU16::new(4544);
|
||||||
fn get_port() -> u16 {
|
fn get_port() -> u16 {
|
||||||
static mut NEXT_PORT: u16 = 4544;
|
let p = NEXT_PORT.load(Ordering::SeqCst);
|
||||||
|
NEXT_PORT.store(p.wrapping_add(1), Ordering::SeqCst);
|
||||||
// TODO(bartlomieju):
|
|
||||||
#[allow(clippy::undocumented_unsafe_blocks)]
|
|
||||||
let port = unsafe {
|
|
||||||
let p = NEXT_PORT;
|
|
||||||
NEXT_PORT += 1;
|
|
||||||
p
|
p
|
||||||
};
|
|
||||||
|
|
||||||
port
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn server_addr(port: u16) -> String {
|
fn server_addr(port: u16) -> String {
|
||||||
|
|
Loading…
Add table
Reference in a new issue