diff --git a/.gitignore b/.gitignore index b059f05..e37fbc7 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ /pkg /tmp /Cargo.lock +perf.data +flamegraph.svg diff --git a/Cargo.lock b/Cargo.lock index f624fe1..23ec3f5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -662,7 +662,7 @@ checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" [[package]] name = "eframe" version = "0.18.0" -source = "git+https://github.com/Titaniumtown/egui.git#1797df1670ae95b5da81fb99324531f6737826e9" +source = "git+https://github.com/Titaniumtown/egui.git#63980778541f105b139e6db0095c10a0f2ce4ad1" dependencies = [ "bytemuck", "egui", @@ -682,7 +682,7 @@ dependencies = [ [[package]] name = "egui" version = "0.18.1" -source = "git+https://github.com/Titaniumtown/egui.git#1797df1670ae95b5da81fb99324531f6737826e9" +source = "git+https://github.com/Titaniumtown/egui.git#63980778541f105b139e6db0095c10a0f2ce4ad1" dependencies = [ "ahash", "epaint", @@ -693,7 +693,7 @@ dependencies = [ [[package]] name = "egui-winit" version = "0.18.0" -source = "git+https://github.com/Titaniumtown/egui.git#1797df1670ae95b5da81fb99324531f6737826e9" +source = "git+https://github.com/Titaniumtown/egui.git#63980778541f105b139e6db0095c10a0f2ce4ad1" dependencies = [ "arboard", "egui", @@ -706,7 +706,7 @@ dependencies = [ [[package]] name = "egui_glow" version = "0.18.1" -source = "git+https://github.com/Titaniumtown/egui.git#1797df1670ae95b5da81fb99324531f6737826e9" +source = "git+https://github.com/Titaniumtown/egui.git#63980778541f105b139e6db0095c10a0f2ce4ad1" dependencies = [ "bytemuck", "egui", @@ -726,7 +726,7 @@ checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" [[package]] name = "emath" version = "0.18.0" -source = "git+https://github.com/Titaniumtown/egui.git#1797df1670ae95b5da81fb99324531f6737826e9" +source = "git+https://github.com/Titaniumtown/egui.git#63980778541f105b139e6db0095c10a0f2ce4ad1" dependencies = [ "bytemuck", "libm", @@ -736,7 +736,7 @@ dependencies = [ [[package]] name = "epaint" version = "0.18.1" -source = "git+https://github.com/Titaniumtown/egui.git#1797df1670ae95b5da81fb99324531f6737826e9" +source = "git+https://github.com/Titaniumtown/egui.git#63980778541f105b139e6db0095c10a0f2ce4ad1" dependencies = [ "ab_glyph", "ahash", @@ -1845,9 +1845,9 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.9.2" +version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f51245e1e62e1f1629cbfec37b5793bbabcaeb90f30e94d2ba03564687353e4" +checksum = "258bcdb5ac6dad48491bb2992db6b7cf74878b0384908af124823d118c99683f" dependencies = [ "crossbeam-channel", "crossbeam-deque", @@ -1923,7 +1923,7 @@ dependencies = [ [[package]] name = "ruzstd" version = "0.2.4" -source = "git+https://github.com/Titaniumtown/zstd-rs.git?branch=ringbuffer#1b2f128459f6a899788465bc005d75f0240c9eae" +source = "git+https://github.com/Titaniumtown/zstd-rs.git?branch=ringbuffer#56972fa1fe8b188ad2f1f54fe1fe35d9479a2d9f" dependencies = [ "byteorder", "twox-hash", diff --git a/src/function_entry.rs b/src/function_entry.rs index b50677d..1dbceec 100644 --- a/src/function_entry.rs +++ b/src/function_entry.rs @@ -531,7 +531,7 @@ impl FunctionEntry { } // return value rounded to 8 decimal places - Some(crate::misc::decimal_round(integral_data.1, 8)) + Some(emath::round_to_decimals(integral_data.1, 8)) } _ => None, } diff --git a/src/lib.rs b/src/lib.rs index 9ddba95..f9692e8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -28,8 +28,14 @@ pub use crate::{ function_entry::{FunctionEntry, Riemann}, math_app::AppSettings, misc::{ - decimal_round, format_bytes, hashed_storage_create, hashed_storage_read, - option_vec_printer, resolution_helper, step_helper, SteppedVector, + // decimal_round, + format_bytes, + hashed_storage_create, + hashed_storage_read, + option_vec_printer, + resolution_helper, + step_helper, + SteppedVector, }, }; diff --git a/src/misc.rs b/src/misc.rs index 4999f1d..438b531 100644 --- a/src/misc.rs +++ b/src/misc.rs @@ -188,13 +188,13 @@ impl EguiHelper for Vec { fn to_tuple(&self) -> Vec<(f64, f64)> { self.iter().map(|ele| (ele.x, ele.y)).collect() } } -/// Rounds f64 to `n` decimal places -pub fn decimal_round(x: f64, n: usize) -> f64 { - let large_number: f64 = 10.0_f64.powf(n as f64); // 10^n +// /// Rounds f64 to `n` decimal places +// pub fn decimal_round(x: f64, n: usize) -> f64 { +// let large_number: f64 = 10.0_f64.powf(n as f64); // 10^n - // round and devide in order to cutoff after the `n`th decimal place - (x * large_number).round() / large_number -} +// // round and devide in order to cutoff after the `n`th decimal place +// (x * large_number).round() / large_number +// } /// Helper that assists with using newton's method of finding roots, iterating over data `data` /// `threshold` is the target accuracy threshold diff --git a/tests/misc.rs b/tests/misc.rs index 4de7e66..13f067f 100644 --- a/tests/misc.rs +++ b/tests/misc.rs @@ -26,26 +26,26 @@ fn stepped_vector() { assert_eq!(stepped_vector.get_index((max + 1) as f64), None); } -/// Ensures [`decimal_round`] returns correct values -#[test] -fn decimal_round() { - use ytbn_graphing_software::decimal_round; +// /// Ensures [`decimal_round`] returns correct values +// #[test] +// fn decimal_round() { +// use ytbn_graphing_software::decimal_round; - assert_eq!(decimal_round(0.00001, 1), 0.0); - assert_eq!(decimal_round(0.00001, 2), 0.0); - assert_eq!(decimal_round(0.00001, 3), 0.0); - assert_eq!(decimal_round(0.00001, 4), 0.0); - assert_eq!(decimal_round(0.00001, 5), 0.00001); +// assert_eq!(decimal_round(0.00001, 1), 0.0); +// assert_eq!(decimal_round(0.00001, 2), 0.0); +// assert_eq!(decimal_round(0.00001, 3), 0.0); +// assert_eq!(decimal_round(0.00001, 4), 0.0); +// assert_eq!(decimal_round(0.00001, 5), 0.00001); - assert_eq!(decimal_round(0.12345, 1), 0.1); - assert_eq!(decimal_round(0.12345, 2), 0.12); - assert_eq!(decimal_round(0.12345, 3), 0.123); - assert_eq!(decimal_round(0.12345, 4), 0.1235); // rounds up - assert_eq!(decimal_round(0.12345, 5), 0.12345); +// assert_eq!(decimal_round(0.12345, 1), 0.1); +// assert_eq!(decimal_round(0.12345, 2), 0.12); +// assert_eq!(decimal_round(0.12345, 3), 0.123); +// assert_eq!(decimal_round(0.12345, 4), 0.1235); // rounds up +// assert_eq!(decimal_round(0.12345, 5), 0.12345); - assert_eq!(decimal_round(1.9, 0), 2.0); - assert_eq!(decimal_round(1.9, 1), 1.9); -} +// assert_eq!(decimal_round(1.9, 0), 2.0); +// assert_eq!(decimal_round(1.9, 1), 1.9); +// } /// Tests [`resolution_helper`] to make sure it returns expected output #[test]