Remove all rustc benchmarks
Co-authored-by: Christian Duerr <contact@christianduerr.com>
This commit is contained in:
parent
753c4ed19e
commit
7291702f6b
|
@ -65,4 +65,3 @@ default = ["wayland", "x11"]
|
|||
x11 = ["copypasta/x11", "glutin/x11", "x11-dl", "png"]
|
||||
wayland = ["copypasta/wayland", "glutin/wayland", "wayland-client"]
|
||||
nightly = []
|
||||
bench = []
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
#![warn(rust_2018_idioms, future_incompatible)]
|
||||
#![deny(clippy::all, clippy::if_not_else, clippy::enum_glob_use, clippy::wrong_pub_self_convention)]
|
||||
#![cfg_attr(feature = "cargo-clippy", deny(warnings))]
|
||||
#![cfg_attr(all(test, feature = "bench"), feature(test))]
|
||||
// With the default subsystem, 'console', windows creates an additional console
|
||||
// window for the program.
|
||||
// This is silently ignored on non-windows systems.
|
||||
|
|
|
@ -39,9 +39,5 @@ winapi = { version = "0.3.7", features = [
|
|||
]}
|
||||
mio-anonymous-pipes = "0.1"
|
||||
|
||||
[features]
|
||||
default = []
|
||||
bench = []
|
||||
|
||||
[dev-dependencies]
|
||||
serde_json = "1.0.0"
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
#![warn(rust_2018_idioms, future_incompatible)]
|
||||
#![deny(clippy::all, clippy::if_not_else, clippy::enum_glob_use, clippy::wrong_pub_self_convention)]
|
||||
#![cfg_attr(feature = "cargo-clippy", deny(warnings))]
|
||||
#![cfg_attr(all(test, feature = "bench"), feature(test))]
|
||||
|
||||
pub mod ansi;
|
||||
pub mod config;
|
||||
|
|
|
@ -192,23 +192,3 @@ mod tests {
|
|||
assert_eq!(row.line_length(), Column(10));
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(test, feature = "bench"))]
|
||||
mod benches {
|
||||
extern crate test;
|
||||
|
||||
use super::*;
|
||||
|
||||
#[bench]
|
||||
fn cell_reset(b: &mut test::Bencher) {
|
||||
b.iter(|| {
|
||||
let mut cell = Cell::default();
|
||||
|
||||
for _ in 0..100 {
|
||||
cell = test::black_box(Color::Named(NamedColor::Foreground).into());
|
||||
}
|
||||
|
||||
test::black_box(cell);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2376,63 +2376,3 @@ mod tests {
|
|||
assert_eq!(version_number("999.99.99"), 9_99_99_99);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(test, feature = "bench"))]
|
||||
mod benches {
|
||||
extern crate serde_json as json;
|
||||
extern crate test;
|
||||
|
||||
use std::fs;
|
||||
use std::mem;
|
||||
|
||||
use crate::config::MockConfig;
|
||||
use crate::event::{Event, EventListener};
|
||||
use crate::grid::Grid;
|
||||
|
||||
use super::cell::Cell;
|
||||
use super::{SizeInfo, Term};
|
||||
|
||||
struct Mock;
|
||||
impl EventListener for Mock {
|
||||
fn send_event(&self, _event: Event) {}
|
||||
}
|
||||
|
||||
/// Benchmark for the renderable cells iterator.
|
||||
///
|
||||
/// The renderable cells iterator yields cells that require work to be
|
||||
/// displayed (that is, not an empty background cell). This benchmark
|
||||
/// measures how long it takes to process the whole iterator.
|
||||
///
|
||||
/// When this benchmark was first added, it averaged ~78usec on my macbook
|
||||
/// pro. The total render time for this grid is anywhere between ~1500 and
|
||||
/// ~2000usec (measured imprecisely with the visual meter).
|
||||
#[bench]
|
||||
fn render_iter(b: &mut test::Bencher) {
|
||||
// Need some realistic grid state; using one of the ref files.
|
||||
let serialized_grid = fs::read_to_string(concat!(
|
||||
env!("CARGO_MANIFEST_DIR"),
|
||||
"/tests/ref/vim_large_window_scroll/grid.json"
|
||||
))
|
||||
.unwrap();
|
||||
let serialized_size = fs::read_to_string(concat!(
|
||||
env!("CARGO_MANIFEST_DIR"),
|
||||
"/tests/ref/vim_large_window_scroll/size.json"
|
||||
))
|
||||
.unwrap();
|
||||
|
||||
let mut grid: Grid<Cell> = json::from_str(&serialized_grid).unwrap();
|
||||
let size: SizeInfo = json::from_str(&serialized_size).unwrap();
|
||||
|
||||
let config = MockConfig::default();
|
||||
|
||||
let mut terminal = Term::new(&config, size, Mock);
|
||||
mem::swap(&mut terminal.grid, &mut grid);
|
||||
|
||||
b.iter(|| {
|
||||
let iter = terminal.renderable_cells(&config, true);
|
||||
for cell in iter {
|
||||
test::black_box(cell);
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -770,26 +770,3 @@ mod tests {
|
|||
assert_eq!(term.regex_search_left(start, end), Some(match_start..=match_end));
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(test, feature = "bench"))]
|
||||
mod benches {
|
||||
extern crate test;
|
||||
|
||||
use super::*;
|
||||
|
||||
use crate::term::test::mock_term;
|
||||
|
||||
#[bench]
|
||||
fn regex_search(b: &mut test::Bencher) {
|
||||
let input = format!("{:^10000}", "Alacritty");
|
||||
let mut term = mock_term(&input);
|
||||
term.regex_search = Some(RegexSearch::new(" Alacritty ").unwrap());
|
||||
let start = Point::new(0, Column(0));
|
||||
let end = Point::new(0, Column(input.len() - 1));
|
||||
|
||||
b.iter(|| {
|
||||
test::black_box(term.regex_search_right(start, end));
|
||||
test::black_box(term.regex_search_left(end, start));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue