Skip to content

Commit bed6c08

Browse files
committed
Cleanup benchmark
- Bump the version number on the development branch to a fresh version number. rust-analyzer has difficulty to figure out what package we are using, make the development branch use a fresh version number to prevent this from happening. Also it make more sense, as we are currently working on a version that is definitely not same as the published version. - Move all the bitmap rasterizer related benchmark to plotters-bitmap
1 parent 88ed50e commit bed6c08

File tree

12 files changed

+41
-25
lines changed

12 files changed

+41
-25
lines changed

plotters-backend/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "plotters-backend"
3-
version = "0.3.1"
3+
version = "0.3.2"
44
authors = ["Hao Hou <[email protected]>"]
55
edition = "2018"
66
license = "MIT"

plotters-bitmap/Cargo.toml

+11-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "plotters-bitmap"
3-
version = "0.3.1"
3+
version = "0.3.2"
44
authors = ["Hao Hou <[email protected]>"]
55
edition = "2018"
66
license = "MIT"
@@ -30,5 +30,14 @@ gif_backend = ["gif", "image_encoder"]
3030

3131
[dev-dependencies.plotters]
3232
default_features = false
33-
features = ["ttf"]
33+
features = ["ttf", "line_series", "bitmap_backend"]
3434
path = "../plotters"
35+
36+
[dev-dependencies]
37+
criterion = "0.3.4"
38+
rayon = "1.5.1"
39+
40+
[[bench]]
41+
name = "benchmark"
42+
harness = false
43+
path = "benches/main.rs"
+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
pub mod parallel;
2+
pub mod rasterizer;

plotters/benches/benches/parallel.rs plotters-bitmap/benches/benches/parallel.rs

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use criterion::{criterion_group, BenchmarkId, Criterion};
22

33
use plotters::coord::Shift;
44
use plotters::prelude::*;
5+
use plotters_bitmap::BitMapBackend;
56
use rayon::prelude::*;
67

78
const SIZES: &'static [u32] = &[100, 400, 800, 1000, 2000];

plotters/benches/benches/rasterizer.rs plotters-bitmap/benches/benches/rasterizer.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use criterion::{criterion_group, Criterion};
22
use plotters::prelude::*;
33
use plotters_backend::BackendStyle;
4-
use plotters_bitmap::bitmap_pixel::BGRXPixel;
4+
use plotters_bitmap::{bitmap_pixel::BGRXPixel, BitMapBackend};
55

66
const W: u32 = 1000;
77
const H: u32 = 1000;

plotters-bitmap/benches/main.rs

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
use criterion::criterion_main;
2+
3+
mod benches;
4+
5+
criterion_main! {
6+
benches::parallel::parallel_group,
7+
benches::rasterizer::rasterizer_group,
8+
}

plotters-bitmap/src/bitmap/test.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,8 @@ fn test_bitmap_blend_large() {
224224
#[cfg(test)]
225225
#[test]
226226
fn test_bitmap_bgrx_pixel_format() {
227-
use crate::bitmap_pixel::BGRXPixel;
228-
use plotters::prelude::*;
227+
use crate::{bitmap_pixel::BGRXPixel, BitMapBackend};
228+
use plotters::prelude::{BLACK, RED, WHITE, GREEN, YELLOW, BLUE, RGBColor, Color};
229229
let mut rgb_buffer = vec![0; 1000 * 1000 * 3];
230230
let mut bgrx_buffer = vec![0; 1000 * 1000 * 4];
231231

plotters-svg/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "plotters-svg"
3-
version = "0.3.1"
3+
version = "0.3.2"
44
authors = ["Hao Hou <[email protected]>"]
55
edition = "2018"
66
license = "MIT"

plotters-svg/src/svg.rs

+13-13
Original file line numberDiff line numberDiff line change
@@ -578,8 +578,8 @@ impl Drop for SVGBackend<'_> {
578578
mod test {
579579
use super::*;
580580
use plotters::element::Circle;
581-
use plotters::prelude::*;
582581
use plotters::style::text_anchor::{HPos, Pos, VPos};
582+
use plotters::prelude::{ChartBuilder, IntoDrawingArea, TextStyle, IntoFont, BLACK, Color, RED, BLUE, SeriesLabelPosition, WHITE};
583583
use std::fs;
584584
use std::path::Path;
585585

@@ -603,8 +603,8 @@ mod test {
603603
let root = SVGBackend::with_string(&mut content, (500, 500)).into_drawing_area();
604604

605605
let mut chart = ChartBuilder::on(&root)
606-
.caption("This is a test", ("sans-serif", 20))
607-
.set_all_label_area_size(40)
606+
.caption("This is a test", ("sans-serif", 20u32))
607+
.set_all_label_area_size(40u32)
608608
.build_cartesian_2d(0..10, 0..10)
609609
.unwrap();
610610

@@ -674,9 +674,9 @@ mod test {
674674
.unwrap();
675675

676676
let mut chart = ChartBuilder::on(&root)
677-
.caption("All anchor point positions", ("sans-serif", 20))
678-
.set_all_label_area_size(40)
679-
.build_cartesian_2d(0..100, 0..50)
677+
.caption("All anchor point positions", ("sans-serif", 20u32))
678+
.set_all_label_area_size(40u32)
679+
.build_cartesian_2d(0..100i32, 0..50i32)
680680
.unwrap();
681681

682682
chart
@@ -763,9 +763,9 @@ mod test {
763763
let root = SVGBackend::with_string(&mut content, (width, height)).into_drawing_area();
764764

765765
let mut chart = ChartBuilder::on(&root)
766-
.caption("All series label positions", ("sans-serif", 20))
767-
.set_all_label_area_size(40)
768-
.build_cartesian_2d(0..50, 0..50)
766+
.caption("All series label positions", ("sans-serif", 20u32))
767+
.set_all_label_area_size(40u32)
768+
.build_cartesian_2d(0..50i32, 0..50i32)
769769
.unwrap();
770770

771771
chart
@@ -776,16 +776,16 @@ mod test {
776776
.unwrap();
777777

778778
chart
779-
.draw_series(std::iter::once(Circle::new((5, 15), 5, &RED)))
779+
.draw_series(std::iter::once(Circle::new((5, 15), 5u32, &RED)))
780780
.expect("Drawing error")
781781
.label("Series 1")
782-
.legend(|(x, y)| Circle::new((x, y), 3, RED.filled()));
782+
.legend(|(x, y)| Circle::new((x, y), 3u32, RED.filled()));
783783

784784
chart
785-
.draw_series(std::iter::once(Circle::new((5, 15), 10, &BLUE)))
785+
.draw_series(std::iter::once(Circle::new((5, 15), 10u32, &BLUE)))
786786
.expect("Drawing error")
787787
.label("Series 2")
788-
.legend(|(x, y)| Circle::new((x, y), 3, BLUE.filled()));
788+
.legend(|(x, y)| Circle::new((x, y), 3u32, BLUE.filled()));
789789

790790
for pos in vec![
791791
SeriesLabelPosition::UpperLeft,

plotters/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "plotters"
3-
version = "0.3.1"
3+
version = "0.3.2"
44
authors = ["Hao Hou <[email protected]>"]
55
edition = "2021"
66
license = "MIT"

plotters/benches/benches/mod.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
11
pub mod data;
2-
pub mod parallel;
3-
pub mod rasterizer;

plotters/benches/main.rs

-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,5 @@ use criterion::criterion_main;
33
mod benches;
44

55
criterion_main! {
6-
benches::parallel::parallel_group,
7-
benches::rasterizer::rasterizer_group,
86
benches::data::quartiles_group
97
}

0 commit comments

Comments
 (0)