Skip to content

Commit

Permalink
Fix scaling factor for window.performance.now in WASM (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
vargad authored Jul 20, 2022
1 parent 1595464 commit 2e4272e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
### Changed

- Fixed build issue on x86/x86_64 platforms that did not have SSE.
- Fixed clock off by a factor of 1000 in wasm/web browser

## [0.10.0] - 2022-05-18

Expand Down
2 changes: 1 addition & 1 deletion src/clocks/monotonic/wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ impl Monotonic {
.expect(WASM_MISSING_WINDOW_PERF)
.now();
// `window.performance.now()` returns the time in milliseconds.
return f64::trunc(now * 1000.0) as u64;
return f64::trunc(now * 1_000_000.0) as u64;
}
}

Expand Down

4 comments on commit 2e4272e

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bench-macOS-latest

Benchmark suite Current: 2e4272e Previous: e803758 Ratio
stdlib/instant_now 17 ns/iter (± 0) 17 ns/iter (± 0) 1
stdlib/instant_delta 59 ns/iter (± 1) 58 ns/iter (± 1) 1.02
quanta/quanta_now 14 ns/iter (± 0) 14 ns/iter (± 0) 1
quanta/quanta_now_delta 29 ns/iter (± 0) 29 ns/iter (± 0) 1
quanta/quanta_instant_now 16 ns/iter (± 0) 16 ns/iter (± 0) 1
quanta/quanta_raw 7 ns/iter (± 0) 7 ns/iter (± 0) 1
quanta/quanta_raw_scaled 8 ns/iter (± 0) 8 ns/iter (± 0) 1
quanta/quanta_raw_delta 17 ns/iter (± 0) 17 ns/iter (± 0) 1
quanta/quanta_recent 2 ns/iter (± 0) 2 ns/iter (± 0) 1
quanta/quanta_instant_recent 2 ns/iter (± 0) 1 ns/iter (± 0) 2

This comment was automatically generated by workflow using github-action-benchmark.

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'bench-macOS-latest'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 0.1.

Benchmark suite Current: 2e4272e Previous: e803758 Ratio
stdlib/instant_now 17 ns/iter (± 0) 17 ns/iter (± 0) 1
stdlib/instant_delta 59 ns/iter (± 1) 58 ns/iter (± 1) 1.02
quanta/quanta_now 14 ns/iter (± 0) 14 ns/iter (± 0) 1
quanta/quanta_now_delta 29 ns/iter (± 0) 29 ns/iter (± 0) 1
quanta/quanta_instant_now 16 ns/iter (± 0) 16 ns/iter (± 0) 1
quanta/quanta_raw 7 ns/iter (± 0) 7 ns/iter (± 0) 1
quanta/quanta_raw_scaled 8 ns/iter (± 0) 8 ns/iter (± 0) 1
quanta/quanta_raw_delta 17 ns/iter (± 0) 17 ns/iter (± 0) 1
quanta/quanta_recent 2 ns/iter (± 0) 2 ns/iter (± 0) 1
quanta/quanta_instant_recent 2 ns/iter (± 0) 1 ns/iter (± 0) 2

This comment was automatically generated by workflow using github-action-benchmark.

CC: @tobz

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bench-ubuntu-latest

Benchmark suite Current: 2e4272e Previous: 1595464 Ratio
stdlib/instant_now 30 ns/iter (± 2) 27 ns/iter (± 0) 1.11
stdlib/instant_delta 69 ns/iter (± 3) 60 ns/iter (± 0) 1.15
quanta/quanta_now 32 ns/iter (± 2) 27 ns/iter (± 0) 1.19
quanta/quanta_now_delta 66 ns/iter (± 4) 59 ns/iter (± 0) 1.12
quanta/quanta_instant_now 37 ns/iter (± 3) 31 ns/iter (± 0) 1.19
quanta/quanta_raw 31 ns/iter (± 2) 26 ns/iter (± 0) 1.19
quanta/quanta_raw_scaled 31 ns/iter (± 1) 27 ns/iter (± 0) 1.15
quanta/quanta_raw_delta 64 ns/iter (± 14) 57 ns/iter (± 0) 1.12
quanta/quanta_recent 2 ns/iter (± 0) 2 ns/iter (± 0) 1
quanta/quanta_instant_recent 2 ns/iter (± 0) 1 ns/iter (± 0) 2

This comment was automatically generated by workflow using github-action-benchmark.

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'bench-ubuntu-latest'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 0.1.

Benchmark suite Current: 2e4272e Previous: 1595464 Ratio
stdlib/instant_now 30 ns/iter (± 2) 27 ns/iter (± 0) 1.11
stdlib/instant_delta 69 ns/iter (± 3) 60 ns/iter (± 0) 1.15
quanta/quanta_now 32 ns/iter (± 2) 27 ns/iter (± 0) 1.19
quanta/quanta_now_delta 66 ns/iter (± 4) 59 ns/iter (± 0) 1.12
quanta/quanta_instant_now 37 ns/iter (± 3) 31 ns/iter (± 0) 1.19
quanta/quanta_raw 31 ns/iter (± 2) 26 ns/iter (± 0) 1.19
quanta/quanta_raw_scaled 31 ns/iter (± 1) 27 ns/iter (± 0) 1.15
quanta/quanta_raw_delta 64 ns/iter (± 14) 57 ns/iter (± 0) 1.12
quanta/quanta_recent 2 ns/iter (± 0) 2 ns/iter (± 0) 1
quanta/quanta_instant_recent 2 ns/iter (± 0) 1 ns/iter (± 0) 2

This comment was automatically generated by workflow using github-action-benchmark.

CC: @tobz

Please sign in to comment.