-
Notifications
You must be signed in to change notification settings - Fork 15
APMSP-2091 Replace OnceLock and get_or_init with LazyLock #1096
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
APMSP-2091 Replace OnceLock and get_or_init with LazyLock #1096
Conversation
Artifact Size Benchmark Reportaarch64-alpine-linux-musl
aarch64-unknown-linux-gnu
libdatadog-x64-windows
libdatadog-x86-windows
x86_64-alpine-linux-musl
x86_64-unknown-linux-gnu
|
BenchmarksComparisonBenchmark execution time: 2025-06-10 15:16:01 Comparing candidate commit d7943c4 in PR branch Found 8 performance improvements and 6 performance regressions! Performance is the same for 38 metrics, 2 unstable metrics. scenario:credit_card/is_card_number/ 3782-8224-6310-005
scenario:credit_card/is_card_number/37828224631000521389798
scenario:credit_card/is_card_number/x371413321323331
scenario:credit_card/is_card_number_no_luhn/ 378282246310005
scenario:credit_card/is_card_number_no_luhn/378282246310005
scenario:credit_card/is_card_number_no_luhn/37828224631000521389798
scenario:credit_card/is_card_number_no_luhn/x371413321323331
CandidateCandidate benchmark detailsGroup 1
Group 2
Group 3
Group 4
Group 5
Group 6
Group 7
Group 8
Group 9
Group 10
Group 11
Group 12
Group 13
BaselineOmitted due to size. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1096 +/- ##
==========================================
- Coverage 71.03% 71.03% -0.01%
==========================================
Files 335 335
Lines 51081 51017 -64
==========================================
- Hits 36287 36241 -46
+ Misses 14794 14776 -18
🚀 New features to boost your workflow:
|
datadog-sidecar/src/setup/unix.rs
Outdated
| #[cfg(feature = "logging")] | ||
| use log::{debug, warn}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we keep the cfgd imports after the unconditional ones?
morrisonlevi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left a small note but overall looks good!
4005c34 to
d7943c4
Compare
|
/merge |
|
View all feedbacks in Devflow UI.
This merge request is not mergeable yet, because of pending checks/missing approvals. It will be added to the queue as soon as checks pass and/or get approvals.
[email protected] unqueued this merge request |
|
/remove |
|
View all feedbacks in Devflow UI.
|
|
all checks is failing again because of the merge queue. Bypassing rules to merge. Everything else passed. |
What does this PR do?
As part of #915 we replaced the usage of the external lazy_static and once_cell crates with std::sync::OnceLock for lazily initializing static variables. The majority of places where use use std::sync::OnceLock is to initialize on first access. For those cases, this PR switches to use std::sync::LazyLock. Functionally, things are the same but the code is slightly simpler, and it's clearer that you are dealing with a static object.
Motivation
LazyLock wasn't stabilized until Rust 1.80. Now that libdatadog's MSRV is 1.84.1 we can use it.
Additional Notes
There were a couple of places where we left OnceLock because it seemed to be simpler or more appropriate.
How to test the change?
No functionality should have changed. All unit tests should still work.