1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-30 21:30:03 -04:00

Faster galley cache (#699)

* Speed up galley cache by only using the hash as key

This hashes the job but doesn't compare them with Eq,
which speeds up demo_with_tessellate__realistic by 5-6%,
winning back all the performance lost in
https://github.com/emilk/egui/pull/682

* Remove custom Eq/PartialEq code for LayoutJob and friends

* Silence clippy

* Unrelated clippy fixes
This commit is contained in:
Emil Ernerfeldt
2021-09-04 10:19:58 +02:00
committed by GitHub
parent 3b75a84d3b
commit 5f88d89f74
8 changed files with 34 additions and 59 deletions

View File

@@ -1,9 +1,11 @@
#![allow(clippy::derive_hash_xor_eq)] // We need to impl Hash for f32, but we don't implement Eq, which is fine
use super::*;
/// Describes the width and color of a line.
///
/// The default stroke is the same as [`Stroke::none`].
#[derive(Clone, Copy, Debug, Default)]
#[derive(Clone, Copy, Debug, Default, PartialEq)]
#[cfg_attr(feature = "persistence", derive(serde::Deserialize, serde::Serialize))]
pub struct Stroke {
pub width: f32,
@@ -44,12 +46,3 @@ impl std::hash::Hash for Stroke {
color.hash(state);
}
}
impl PartialEq for Stroke {
#[inline(always)]
fn eq(&self, other: &Self) -> bool {
self.color == other.color && crate::f32_eq(self.width, other.width)
}
}
impl std::cmp::Eq for Stroke {}