Change Backtrace::enabled atomic from SeqCst to Relaxed#92139
Merged
bors merged 1 commit intorust-lang:masterfrom Dec 23, 2021
Merged
Change Backtrace::enabled atomic from SeqCst to Relaxed#92139bors merged 1 commit intorust-lang:masterfrom
bors merged 1 commit intorust-lang:masterfrom
Conversation
Contributor
|
r? @m-ou-se (rust-highfive has picked a reviewer for you, use r? to override) |
Member
|
@bors r+ |
Collaborator
|
📌 Commit 984b10d has been approved by |
Collaborator
|
⌛ Testing commit 984b10d with merge b0dcf2c76b3159084138c63b18bd31373c9e679b... |
Collaborator
|
💔 Test failed - checks-actions |
Collaborator
|
The job Click to see the possible cause of the failure (guessed by this bot) |
| }, | ||
| }; | ||
| ENABLED.store(enabled as usize + 1, SeqCst); | ||
| ENABLED.store(enabled as usize + 1, Relaxed); |
Contributor
There was a problem hiding this comment.
How about storing boolean as is in atomic?
I managed to remove 1 branch and make code shorter by this:
godbolt
Contributor
|
The CI error was due to some infrastructure problem. I would retry, but do you want to respond to the comment at #92139 (comment) first? |
Member
Author
|
That comment seems orthogonal to the change in this PR. @bors retry |
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Dec 23, 2021
…askrgr Rollup of 7 pull requests Successful merges: - rust-lang#88858 (Allow reverse iteration of lowercase'd/uppercase'd chars) - rust-lang#91544 (Fix duplicate derive clone suggestion) - rust-lang#92026 (Add some JSDoc comments to rustdoc JS) - rust-lang#92117 (kmc-solid: Add `std::sys::solid::fs::File::read_buf`) - rust-lang#92139 (Change Backtrace::enabled atomic from SeqCst to Relaxed) - rust-lang#92146 (Don't emit shared files when scraping examples from dependencies in Rustdoc) - rust-lang#92208 (Quote bat script command line) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This atomic is not synchronizing anything outside of its own value, so we don't need the
Acquire/Releaseguarantee that all memory operations prior to the store are visible after the subsequent load, nor theSeqCstguarantee of all threads seeing all of the sequentially consistent operations in the same order.Using
Relaxedreduces the overhead ofBacktrace::capture()in the case that backtraces are not enabled.Benchmark
Before: 6.73 seconds
After: 5.18 seconds