Move benchmarks to seperate crate "aquatic_bench"

This commit is contained in:
Joakim Frostegård 2020-04-06 12:49:54 +02:00
parent a627594c3a
commit 165214018c
13 changed files with 40 additions and 34 deletions

13
Cargo.lock generated
View file

@ -28,11 +28,20 @@ dependencies = [
"mimalloc", "mimalloc",
"mio", "mio",
"net2", "net2",
"num-format",
"plotly",
"quickcheck", "quickcheck",
"quickcheck_macros", "quickcheck_macros",
"rand", "rand",
]
[[package]]
name = "aquatic_bench"
version = "0.1.0"
dependencies = [
"aquatic",
"mimalloc",
"num-format",
"plotly",
"rand",
"rand_distr", "rand_distr",
] ]

View file

@ -3,15 +3,9 @@
members = [ members = [
"bittorrent_udp", "bittorrent_udp",
"aquatic", "aquatic",
"aquatic_bench",
] ]
[profile.dev]
debug = true
[profile.release] [profile.release]
debug = true debug = true
lto = true lto = true
[profile.bench]
opt-level = 3
lto = true

View file

@ -6,9 +6,7 @@
* Cleaner code * Cleaner code
* Stack-allocated vector? * Stack-allocated vector?
* Benchmarks * Benchmarks
* Move to own crate (aquatic_bench)
* Better black_box (or make sure to consume data) * Better black_box (or make sure to consume data)
* Show standard deviation?
* Send in connect reponse ids to other functions as integration test * Send in connect reponse ids to other functions as integration test
* target-cpu=native * target-cpu=native

View file

@ -11,31 +11,14 @@ path = "src/lib/lib.rs"
[[bin]] [[bin]]
name = "aquatic" name = "aquatic"
[[bin]]
name = "bench_handlers"
[[bin]]
name = "plot_pareto"
[dependencies] [dependencies]
bittorrent_udp = { path = "../bittorrent_udp" } bittorrent_udp = { path = "../bittorrent_udp" }
dashmap = "3" dashmap = "3"
indexmap = "1" indexmap = "1"
mimalloc = "0.1" mimalloc = "0.1"
mio = { version = "0.7", features = ["udp", "os-poll", "os-util"] }
net2 = "0.2" net2 = "0.2"
rand = { version = "0.7", features = ["small_rng"] }
# bench_handlers / plot_pareto
num-format = "0.4"
rand_distr = "0.2"
plotly = "0.4"
[dependencies.mio]
version = "0.7"
features = ["udp", "os-poll", "os-util"]
[dependencies.rand]
version = "0.7"
features = ["small_rng"]
[dev-dependencies] [dev-dependencies]
quickcheck = "0.9" quickcheck = "0.9"

View file

@ -1,6 +1,5 @@
use std::time::Duration; use std::time::Duration;
pub mod bench_utils;
pub mod common; pub mod common;
pub mod handlers; pub mod handlers;
pub mod network; pub mod network;

23
aquatic_bench/Cargo.toml Normal file
View file

@ -0,0 +1,23 @@
[package]
name = "aquatic_bench"
version = "0.1.0"
authors = ["Joakim Frostegård <joakim.frostegard@gmail.com>"]
edition = "2018"
[lib]
name = "aquatic_bench"
[[bin]]
name = "bench_handlers"
[[bin]]
name = "plot_pareto"
[dependencies]
aquatic = { path = "../aquatic" }
mimalloc = "0.1"
num-format = "0.4"
plotly = "0.4"
rand_distr = "0.2"
rand = { version = "0.7", features = ["small_rng"] }

View file

@ -4,9 +4,9 @@ use std::net::SocketAddr;
use rand::Rng; use rand::Rng;
use rand_distr::Pareto; use rand_distr::Pareto;
use aquatic::bench_utils::*;
use aquatic::handlers::*; use aquatic::handlers::*;
use aquatic::common::*; use aquatic::common::*;
use aquatic_bench::*;
use crate::common::*; use crate::common::*;

View file

@ -4,9 +4,9 @@ use std::net::SocketAddr;
use rand::Rng; use rand::Rng;
use rand_distr::Pareto; use rand_distr::Pareto;
use aquatic::bench_utils::*;
use aquatic::handlers::*; use aquatic::handlers::*;
use aquatic::common::*; use aquatic::common::*;
use aquatic_bench::*;
use crate::common::*; use crate::common::*;

View file

@ -4,7 +4,7 @@ use plotly::layout::Axis;
use rand::{thread_rng, rngs::SmallRng, SeedableRng}; use rand::{thread_rng, rngs::SmallRng, SeedableRng};
use rand_distr::Pareto; use rand_distr::Pareto;
use aquatic::bench_utils::pareto_usize; use aquatic_bench::pareto_usize;
fn main(){ fn main(){