perf: disable supersampling

This commit is contained in:
Ilya Zlobintsev 2025-02-10 19:01:32 +02:00
parent 5bd588738f
commit f58a77fa2c
3 changed files with 13 additions and 8 deletions

View File

@ -38,12 +38,13 @@ impl relm4::Component for GraphsWindow {
set_margin_all: 10,
set_row_spacing: 20,
set_column_spacing: 20,
set_column_homogeneous: true,
attach[0, 0, 1, 1]: temperature_plot = &Plot {
set_title: "Temperature",
set_hexpand: true,
set_value_suffix: "°C",
set_y_label_area_relative_size: 0.15,
set_y_label_area_relative_size: 0.2,
#[watch]
set_time_period_seconds: model.time_period_seconds_adj.value() as i64,
},
@ -52,7 +53,7 @@ impl relm4::Component for GraphsWindow {
set_title: "Fan speed",
set_hexpand: true,
set_value_suffix: "RPM",
set_y_label_area_relative_size: 0.25,
set_y_label_area_relative_size: 0.3,
set_secondary_y_label_area_relative_size: 0.15,
#[watch]
set_time_period_seconds: model.time_period_seconds_adj.value() as i64,

View File

@ -9,6 +9,8 @@ use std::collections::BTreeMap;
use super::render_thread::{RenderRequest, RenderThread};
const SUPERSAMPLE_FACTOR: u32 = 1;
#[derive(Properties, Default)]
#[properties(wrapper_type = super::Plot)]
pub struct Plot {
@ -75,7 +77,7 @@ impl WidgetImpl for Plot {
secondary_y_label_relative_area_size: self
.secondary_y_label_area_relative_size
.get(),
supersample_factor: 4,
supersample_factor: SUPERSAMPLE_FACTOR,
time_period_seconds: self.time_period_seconds.get(),
});
}
@ -204,6 +206,8 @@ mod benches {
use divan::{counter::ItemsCount, Bencher};
use std::sync::Mutex;
use super::SUPERSAMPLE_FACTOR;
#[divan::bench]
fn render_plot(bencher: Bencher) {
let last_texture = &Mutex::new(None);
@ -221,7 +225,7 @@ mod benches {
data,
width: 1920,
height: 1080,
supersample_factor: 4,
supersample_factor: SUPERSAMPLE_FACTOR,
time_period_seconds: 60,
};

View File

@ -343,12 +343,12 @@ impl RenderRequest {
(current_date, segment.evaluate(current_date))
})
}),
Palette99::pick(idx).stroke_width(8),
Palette99::pick(idx).stroke_width(2),
))
.context("Failed to draw series")?
.label(caption)
.legend(move |(x, y)| {
let offset = self.relative_size(0.04) as i32;
let offset = self.relative_size(0.02) as i32;
Rectangle::new(
[(x - offset, y - offset), (x + offset, y + offset)],
Palette99::pick(idx).filled(),
@ -367,12 +367,12 @@ impl RenderRequest {
(current_date, segment.evaluate(current_date))
})
}),
Palette99::pick(idx + 10).stroke_width(8),
Palette99::pick(idx + 10).stroke_width(2),
))
.context("Failed to draw series")?
.label(caption)
.legend(move |(x, y)| {
let offset = self.relative_size(0.04) as i32;
let offset = self.relative_size(0.02) as i32;
Rectangle::new(
[(x - offset, y - offset), (x + offset, y + offset)],
Palette99::pick(idx + 10).filled(),