diff --git a/Cargo.lock b/Cargo.lock index bedb4af3c0c..5c5a69c231c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2065,7 +2065,6 @@ dependencies = [ "servo_url", "smallvec", "style", - "time 0.1.45", "truetype", "ucd", "unicode-bidi", diff --git a/components/gfx/Cargo.toml b/components/gfx/Cargo.toml index 3d9db55ec8a..47abe285644 100644 --- a/components/gfx/Cargo.toml +++ b/components/gfx/Cargo.toml @@ -34,7 +34,6 @@ servo_atoms = { path = "../atoms" } servo_url = { path = "../url" } smallvec = { workspace = true, features = ["union"] } style = { path = "../style", features = ["servo"] } -time = { workspace = true } ucd = "0.1.1" unicode-bidi = { workspace = true, features = ["with_serde"] } unicode-script = { workspace = true } diff --git a/components/gfx/font.rs b/components/gfx/font.rs index 770603f1e63..77e27158826 100644 --- a/components/gfx/font.rs +++ b/components/gfx/font.rs @@ -8,6 +8,7 @@ use std::collections::HashMap; use std::rc::Rc; use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::Arc; +use std::time::Instant; use std::{iter, str}; use app_units::Au; @@ -253,7 +254,7 @@ impl Font { .borrow_mut() .entry(lookup_key) .or_insert_with(|| { - let start_time = time::precise_time_ns(); + let start_time = Instant::now(); let mut glyphs = GlyphStore::new( text.len(), options @@ -276,9 +277,11 @@ impl Font { .shape_text(text, options, &mut glyphs); } - let end_time = time::precise_time_ns(); - TEXT_SHAPING_PERFORMANCE_COUNTER - .fetch_add((end_time - start_time) as usize, Ordering::Relaxed); + let end_time = Instant::now(); + TEXT_SHAPING_PERFORMANCE_COUNTER.fetch_add( + (end_time.duration_since(start_time).as_nanos()) as usize, + Ordering::Relaxed, + ); Arc::new(glyphs) }) .clone();