From 6e8c562b4481b4c35ab47ba3c01ad9124f0d7564 Mon Sep 17 00:00:00 2001 From: tottoto Date: Thu, 10 Aug 2023 15:24:00 +0900 Subject: [PATCH 1/4] Remove futures from async feature (#676) --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index b3b745d2a..5c55c61bc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -75,7 +75,7 @@ default = ["rayon", "plotters", "cargo_bench_support"] real_blackbox = [] # Enable async/await support -async = ["futures"] +async = [] # These features enable built-in support for running async benchmarks on each different async # runtime. From 7feeb35f4cad749e6dc6b42fe2aec35130339a47 Mon Sep 17 00:00:00 2001 From: frederikhors <41120635+frederikhors@users.noreply.github.com> Date: Thu, 10 Aug 2023 08:25:04 +0200 Subject: [PATCH 2/4] explain `html_reports` feature in html_report.md (#621) --- book/src/user_guide/html_report.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/book/src/user_guide/html_report.md b/book/src/user_guide/html_report.md index 052a60a86..e6de42bd6 100644 --- a/book/src/user_guide/html_report.md +++ b/book/src/user_guide/html_report.md @@ -1,5 +1,10 @@ # HTML Report +Starting with Criterion.rs 0.4.0 HTML reports must be explicitly enabled via the `html_reports` [feature](https://doc.rust-lang.org/cargo/reference/features.html#dependency-features): +```toml +[dev-dependencies] +criterion = {version = "0.4.0", features = ["html_reports"] } +``` Criterion.rs can generate an HTML report displaying the results of the benchmark under `target/criterion/reports/index.html`. By default, the plots are generated using [gnuplot](http://www.gnuplot.info/) if it is available, or the From daa84cafe706e731139c768f7c67cc5577041309 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20M=C3=BCller?= Date: Wed, 9 Aug 2023 23:26:50 -0700 Subject: [PATCH 3/4] Include thousands-separators in `bencher` output (#705) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As mentioned in #704, the output generated when using the `bencher` output format does not quite match up with that of libtest. One reason being that thousands-separators are not emitted. With this change we adjust the formatting logic for integers (which is only used in `bencher` style reports) to emit thousands-separators, as libtest does. Signed-off-by: Daniel Müller --- src/format.rs | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/src/format.rs b/src/format.rs index 53c4a4dbd..d536ab96b 100644 --- a/src/format.rs +++ b/src/format.rs @@ -72,8 +72,35 @@ pub fn iter_count(iterations: u64) -> String { } } +/// Format a number with thousands separators. +// Based on the corresponding libtest functionality, see +// https://github.com/rust-lang/rust/blob/557359f92512ca88b62a602ebda291f17a953002/library/test/src/bench.rs#L87-L109 +fn thousands_sep(mut n: u64, sep: char) -> String { + use std::fmt::Write; + let mut output = String::new(); + let mut trailing = false; + for &pow in &[9, 6, 3, 0] { + let base = 10_u64.pow(pow); + if pow == 0 || trailing || n / base != 0 { + if !trailing { + write!(output, "{}", n / base).unwrap(); + } else { + write!(output, "{:03}", n / base).unwrap(); + } + if pow != 0 { + output.push(sep); + } + trailing = true; + } + n %= base; + } + + output +} + +/// Format a value as an integer, including thousands-separators. pub fn integer(n: f64) -> String { - format!("{}", n as u64) + thousands_sep(n as u64, ',') } #[cfg(test)] @@ -101,4 +128,10 @@ mod test { float *= 2.0; } } + + #[test] + fn integer_thousands_sep() { + let n = 140352319.0; + assert_eq!(integer(n), "140,352,319"); + } } From c0461a6a7f42f86e8d6533ab082babe84e5c13b0 Mon Sep 17 00:00:00 2001 From: Shaun Jackman Date: Thu, 10 Aug 2023 23:19:33 -0700 Subject: [PATCH 4/4] ci: Remove AppVeyor (#699) --- README.md | 9 +++------ appveyor.yml | 34 ---------------------------------- 2 files changed, 3 insertions(+), 40 deletions(-) delete mode 100644 appveyor.yml diff --git a/README.md b/README.md index b6f24138e..5e2dabc71 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@
Statistics-driven Microbenchmarking in Rust
- Getting Started + Getting Started | User Guide | @@ -15,14 +15,10 @@
- + GitHub branch checks state | - - Appveyor - - | Crates.io @@ -31,6 +27,7 @@ Criterion.rs helps you write fast code by detecting and measuring performance improvements or regressions, even small ones, quickly and accurately. You can optimize with confidence, knowing how each change affects the performance of your code. ## Table of Contents + - [Table of Contents](#table-of-contents) - [Features](#features) - [Quickstart](#quickstart) diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 2412672b8..000000000 --- a/appveyor.yml +++ /dev/null @@ -1,34 +0,0 @@ -environment: - matrix: - - TARGET: x86_64-pc-windows-msvc - GNUPLOT: yes - - TARGET: x86_64-pc-windows-msvc - GNUPLOT: no - -cache: - - 'C:\Users\appveyor\.cargo' - -install: - - curl -sSf -o rustup-init.exe https://win.rustup.rs/ - - rustup-init.exe -y --default-host %TARGET% --default-toolchain stable - - SET PATH=%PATH%;C:\Users\appveyor\.cargo\bin - - rustc -Vv - - cargo -V - - ps: if (${env:GNUPLOT} -eq "yes") { Start-FileDownload "https://sourceforge.net/projects/gnuplot/files/gnuplot/4.6.7/gp467-win64-setup.exe"; } - - if %GNUPLOT%==yes gp467-win64-setup.exe /VERYSILENT /NORESTART - - if %GNUPLOT%==yes SET PATH=%PATH%;C:\Program Files\gnuplot\bin - -build: false - -# Disabled in favor of github actions -test_script: -# - cargo build --release -# - cargo test --all --release -# - cargo build --benches --all --release -# Disable benchmarking until performance can be improved. -# - cargo bench -# - cargo doc --release --all --no-deps - -branches: - only: - - master