1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-31 13:50:04 -04:00

Optimize: add #[inline(always)] to various low-level things

saves up to 20% (text tesselation), and at least 5% overall
This commit is contained in:
Emil Ernerfeldt
2021-03-28 23:16:19 +02:00
parent ccc501f302
commit 46425f1e38
10 changed files with 144 additions and 7 deletions

View File

@@ -20,9 +20,13 @@ macro_rules! impl_numeric_float {
const INTEGRAL: bool = false;
const MIN: Self = std::$t::MIN;
const MAX: Self = std::$t::MAX;
#[inline(always)]
fn to_f64(self) -> f64 {
self as f64
}
#[inline(always)]
fn from_f64(num: f64) -> Self {
num as Self
}
@@ -36,9 +40,13 @@ macro_rules! impl_numeric_integer {
const INTEGRAL: bool = true;
const MIN: Self = std::$t::MIN;
const MAX: Self = std::$t::MAX;
#[inline(always)]
fn to_f64(self) -> f64 {
self as f64
}
#[inline(always)]
fn from_f64(num: f64) -> Self {
num as Self
}