summaryrefslogtreecommitdiff
path: root/cli/bench/throughput.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/bench/throughput.rs')
-rw-r--r--cli/bench/throughput.rs13
1 files changed, 4 insertions, 9 deletions
diff --git a/cli/bench/throughput.rs b/cli/bench/throughput.rs
index 78c9235fe..6fd3972d1 100644
--- a/cli/bench/throughput.rs
+++ b/cli/bench/throughput.rs
@@ -1,7 +1,6 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
use super::Result;
-use deno_core::serde_json::{Number, Value};
use std::{
path::PathBuf,
process::Command,
@@ -12,7 +11,7 @@ const MB: usize = 1024 * 1024;
const SERVER_ADDR: &str = "0.0.0.0:4544";
const CLIENT_ADDR: &str = "127.0.0.1 4544";
-pub(crate) fn cat(deno_exe: &PathBuf, megs: usize) -> Result<Value> {
+pub(crate) fn cat(deno_exe: &PathBuf, megs: usize) -> Result<f64> {
let size = megs * MB;
let shell_cmd = format!(
"{} run --allow-read cli/tests/cat.ts /dev/zero | head -c {}",
@@ -26,12 +25,10 @@ pub(crate) fn cat(deno_exe: &PathBuf, megs: usize) -> Result<Value> {
let _ = test_util::run_collect(cmd, None, None, None, true);
let end = Instant::now();
- Ok(Value::Number(
- Number::from_f64((end - start).as_secs_f64()).unwrap(),
- ))
+ Ok((end - start).as_secs_f64())
}
-pub(crate) fn tcp(deno_exe: &PathBuf, megs: usize) -> Result<Value> {
+pub(crate) fn tcp(deno_exe: &PathBuf, megs: usize) -> Result<f64> {
let size = megs * MB;
// The GNU flavor of `nc` requires the `-N` flag to shutdown the network socket after EOF on stdin
@@ -66,7 +63,5 @@ pub(crate) fn tcp(deno_exe: &PathBuf, megs: usize) -> Result<Value> {
echo_server.kill()?;
- Ok(Value::Number(
- Number::from_f64((end - start).as_secs_f64()).unwrap(),
- ))
+ Ok((end - start).as_secs_f64())
}