Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update quanta requirement from 0.9.0 to 0.11.0 #175

Merged
merged 6 commits into from
May 20, 2023

Conversation

dependabot[bot]
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Mar 25, 2023

Updates the requirements on quanta to permit the latest version.

Changelog

Sourced from quanta's changelog.

[0.11.0] - 2023-03-24

Added

  • Instant::elapsed() has been added. (#82)

Changed

  • Instant::duration_since and Instant::sub now saturates to zero. (#82)
  • Performance of Instant::now under high contention has been improved. (#82)

#82: metrics-rs/quanta#82

[0.10.1] - 2022-07-20

Added

  • Implement std::error::Error for quanta::Error. (#68)

Changed

  • Fixed build issue on x86/x86_64 platforms that did not have SSE.
  • Fix scaling factor for window.performance.now() in WASM. (#72)

#72: metrics-rs/quanta#72 #68: metrics-rs/quanta#68

[0.10.0] - 2022-05-18

Changed

  • Documentation has been updated to reflect that quanta does not track time across system suspends.
  • Fixed a panic in the calibration loop if a certain edge case with TSC measurements is encountered.
  • Updated a unit test that was frequently flaky to be more precise.

Removed

  • Instant::as_u64 has been removed. As it provided direct access to an value that could fundamentally change from version-to-version, it felt like time to remove that footgun and push users more towards the API that mimics std::time.
  • Clock::upkeep has been removed. It doesn't need to exist on Clock directly, as we have had the quanta::set_recent free function for a while now, and was just duplicating that.
  • Clock::start and Clock::end have been removed. They saw limited usage and overall just added somewhat needless API clutter given that users who are looking to do ultra-precise timing will either want more control or use another technique such as instruction counting.

0.9.3 - 2021-09-16

Added

... (truncated)

Commits
  • f5404fe (cargo-release) version 0.11.0
  • 70a6ab8 switch away from actions-rs due to deprecated node.js versioning stuff + gene...
  • a4f2055 fix clobbering of global recent time making tests flaky + formatting
  • 2eb5cd2 Avoid contention on Instant::now() calls (#82)
  • 7433c21 Update wasi requirement from 0.10 to 0.11 (#77)
  • cf035b8 For macos and ios switch from mach crate to mach2 crate (#79)
  • fe14834 bump edition to 2021 and MSRV to 1.60.0
  • e499709 Update prost-types requirement from 0.8 to 0.11 (#74)
  • 3a7d361 (cargo-release) version 0.10.1
  • 278c0b9 downgrade/pin criterion to v0.3.3 to avoid semver breaking upgrade to plotter...
  • Additional commits viewable in compare view

You can trigger a rebase of this PR by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
> **Note** > Automatic rebases have been disabled on this pull request as it has been open for over 30 days.

Updates the requirements on [quanta](https://github.com/metrics-rs/quanta) to permit the latest version.
- [Release notes](https://github.com/metrics-rs/quanta/releases)
- [Changelog](https://github.com/metrics-rs/quanta/blob/main/CHANGELOG.md)
- [Commits](metrics-rs/quanta@v0.9.0...v0.11.0)

---
updated-dependencies:
- dependency-name: quanta
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
@dependabot dependabot bot added dependencies Pull requests that update a dependency file rust Pull requests that update Rust code labels Mar 25, 2023
Quanta removed the `as_u64` method on Instant (reasonably)! So now we
have to compare with our own reference instant. To do so, we use
`once_cell::Lazy`.
@antifuchs
Copy link
Collaborator

This fixes #174

@antifuchs antifuchs linked an issue Mar 25, 2023 that may be closed by this pull request
@codecov
Copy link

codecov bot commented Mar 25, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.16 🎉

Comparison is base (ff9d88e) 97.52% compared to head (c4385c9) 97.69%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #175      +/-   ##
==========================================
+ Coverage   97.52%   97.69%   +0.16%     
==========================================
  Files          31       31              
  Lines        2220     2209      -11     
==========================================
- Hits         2165     2158       -7     
+ Misses         55       51       -4     
Impacted Files Coverage Δ
governor/src/clock/quanta.rs 98.55% <100.00%> (+0.21%) ⬆️

... and 18 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@antifuchs
Copy link
Collaborator

Uuuunfortunately, with the move to as_64-less Instants from quanta, this slows down normal in-memory operations by 15-50% (depending on the benchmark). I'll need to profile to find out why that is.

@jqnatividad
Copy link

@antifuchs , just out of curiosity, have you tried turning on once_cell's parking_lot feature and including a parking_lot dependency as well with the hardware-lock-elision feature enabled?

Apparently, per parking_lot's README, the "RwLock takes advantage of hardware lock elision on processors that support it, which can lead to huge performance wins with many readers."

@antifuchs
Copy link
Collaborator

antifuchs commented Mar 30, 2023

Oooh, I hadn't tried that - in profiles, the once cell (or even the math I do on the stored Instant) isn't appearing to make much of a difference to what's on master, but I'll try this in benchmarks and report back!

@antifuchs
Copy link
Collaborator

Update: Same performance against baseline - about 50% slower with the quanta clock. I think quanta might have regressed in performance? I'll have to try this in a more micro benchmark.

This balances out the performance degradation quite a bit (only 28%
slower vs. 50% slower), by scaling the readings less often. This still
means we lose some perf, but at least it's safe!
* master:
  Changelog
  Rephrase the burst capacity section to be less confusing
  Update criterion requirement from 0.3.2 to 0.4.0
  Bump codecov/codecov-action from 3.1.0 to 3.1.1
@antifuchs
Copy link
Collaborator

OK, this iteration is only 28% slower on macOS (see also metrics-rs/quanta#84, which would help - I think!), I'll see how it performs on linux and in CI now.

@antifuchs
Copy link
Collaborator

Huh! This is way faster on linux, with rustc 1.69.0:

:;    cargo bench -- realtime_clock/mostly_deny/QuantaClock --baseline master
    Finished bench [optimized] target(s) in 0.11s
     Running benches/governor_criterion_benches.rs (target/release/deps/governor_criterion_benches-8c8aacd5cc4adf42)
Gnuplot not found, using plotters backend
realtime_clock/mostly_deny/QuantaClock
                        time:   [18.346 ns 18.518 ns 18.703 ns]
                        thrpt:  [53.467 Melem/s 54.000 Melem/s 54.509 Melem/s]
                 change:
                        time:   [-40.149% -39.501% -38.853%] (p = 0.00 < 0.05)
                        thrpt:  [+63.540% +65.292% +67.083%]
                        Performance has improved.
Found 1 outliers among 100 measurements (1.00%)
  1 (1.00%) high mild

I'll take it! Let's ship this.

@antifuchs
Copy link
Collaborator

bors merge

@antifuchs
Copy link
Collaborator

Fixes #178

@antifuchs
Copy link
Collaborator

Fixes #174

@antifuchs antifuchs linked an issue May 20, 2023 that may be closed by this pull request
@bors
Copy link
Contributor

bors bot commented May 20, 2023

Build succeeded!

The publicly hosted instance of bors-ng is deprecated and will go away soon.

If you want to self-host your own instance, instructions are here.
For more help, visit the forum.

If you want to switch to GitHub's built-in merge queue, visit their help page.

@bors bors bot merged commit aa70cfa into master May 20, 2023
@bors bors bot deleted the dependabot/cargo/quanta-0.11.0 branch May 20, 2023 17:34
bors bot added a commit that referenced this pull request May 28, 2023
190: Use direct nanosecond operations in quanta, bring speed back to baseline r=antifuchs a=antifuchs

This uses metrics-rs/quanta#86 to avoid roundtripping nanosecond counts through Duration, which does a bunch of integer math on construction and deconstruction, which we don't even need (unless we exceed the 270 years of governor's useful operational uptime).

In benchmarks, this brings speeds back to the baseline pre-quanta-0.11 (see #175)

Co-authored-by: Andreas Fuchs <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file rust Pull requests that update Rust code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fails to build on x86 without SSE2 due to outdated quanta dep cargo audit finds two addressable warnings
2 participants