Skip to content

Commit

Permalink
perf: improve performance.now (denoland#15481)
Browse files Browse the repository at this point in the history
  • Loading branch information
ry committed Aug 16, 2022
1 parent eab66a9 commit 0b70c81
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ext/web/timers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ where
TP: TimersPermission + 'static,
{
let start_time = state.borrow::<StartTime>();
let seconds = start_time.elapsed().as_secs();
let mut subsec_nanos = start_time.elapsed().subsec_nanos() as f64;
let elapsed = start_time.elapsed();
let seconds = elapsed.as_secs();
let mut subsec_nanos = elapsed.subsec_nanos() as f64;
let reduced_time_precision = 2_000_000.0; // 2ms in nanoseconds

// If the permission is not enabled
Expand Down

0 comments on commit 0b70c81

Please sign in to comment.