Skip to content

Conversation

joboet
Copy link
Member

@joboet joboet commented Aug 29, 2025

The dlsym! macro always ensures that the name string is nul-terminated, so there is no need to perform the check at runtime. Also, acquire loads are generally faster than a load and a barrier, so use them. This is only false in the case where the symbol is missing, but that shouldn't matter too much.

@rustbot
Copy link
Collaborator

rustbot commented Aug 29, 2025

r? @tgross35

rustbot has assigned @tgross35.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added O-unix Operating system: Unix-like S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Aug 29, 2025
@joboet joboet changed the title std: optimize dlsym! macro and add a test for it std: optimize dlsym! macro and add a test for it Aug 29, 2025
@rust-log-analyzer

This comment has been minimized.

@tgross35
Copy link
Contributor

Just curious...

@bors2 try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Aug 29, 2025
std: optimize `dlsym!` macro and add a test for it
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Aug 29, 2025
@rust-bors
Copy link

rust-bors bot commented Aug 30, 2025

☀️ Try build successful (CI)
Build commit: e2bfd7f (e2bfd7fb1f49deb317bdee4685858a4b7e85d848, parent: fe55364329579d361b1ab565728bc033a7dba07e)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (e2bfd7f): comparison URL.

Overall result: ✅ improvements - no action needed

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

@bors rollup=never
@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.2% [-0.2%, -0.2%] 3
Improvements ✅
(secondary)
-2.7% [-2.9%, -2.5%] 6
All ❌✅ (primary) -0.2% [-0.2%, -0.2%] 3

Max RSS (memory usage)

Results (primary -1.0%, secondary -1.9%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
3.0% [2.7%, 3.3%] 2
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-9.0% [-9.0%, -9.0%] 1
Improvements ✅
(secondary)
-1.9% [-1.9%, -1.9%] 1
All ❌✅ (primary) -1.0% [-9.0%, 3.3%] 3

Cycles

Results (primary 1.9%, secondary 2.2%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
1.9% [1.9%, 1.9%] 1
Regressions ❌
(secondary)
2.2% [2.2%, 2.2%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 1.9% [1.9%, 1.9%] 1

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 467.034s -> 466.989s (-0.01%)
Artifact size: 388.52 MiB -> 388.52 MiB (-0.00%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Aug 30, 2025
Copy link
Contributor

@tgross35 tgross35 left a comment

Choose a reason for hiding this comment

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

Looks great, r=me with a squash

View changes since this review

@joboet
Copy link
Member Author

joboet commented Sep 2, 2025

@bors r=@tgross35

@bors
Copy link
Collaborator

bors commented Sep 2, 2025

📌 Commit d0a2761 has been approved by tgross35

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 2, 2025
bors added a commit that referenced this pull request Sep 3, 2025
std: optimize `dlsym!` macro and add a test for it

The `dlsym!` macro always ensures that the name string is nul-terminated, so there is no need to perform the check at runtime. Also, acquire loads are generally faster than a load and a barrier, so use them. This is only false in the case where the symbol is missing, but that shouldn't matter too much.
@bors
Copy link
Collaborator

bors commented Sep 3, 2025

⌛ Testing commit d0a2761 with merge 0b56db0...

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Collaborator

bors commented Sep 3, 2025

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Sep 3, 2025
@rust-bors
Copy link

rust-bors bot commented Sep 9, 2025

💔 Test for 70ecc61 failed: CI. Failed jobs:

@tgross35
Copy link
Contributor

The whole test module should probably be gated. Could you also add a comment at the gate about those being the only platforms that support dlsym?

r=me after that and a passing try

`dlsym` doesn't work for finding libc symbols on platforms like linux-musl, so the test will fail.
@joboet
Copy link
Member Author

joboet commented Sep 10, 2025

@bors2 try jobs=test-various,dist-various-*

@rust-bors

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Sep 10, 2025
std: optimize `dlsym!` macro and add a test for it

try-job: test-various
try-job: dist-various-*
@rust-bors
Copy link

rust-bors bot commented Sep 10, 2025

☀️ Try build successful (CI)
Build commit: 3be231d (3be231d474acc45c62cc116f1f59723443df39c1, parent: 7ad23f43a225546c095123de52cc07d8719f8e2b)

@joboet
Copy link
Member Author

joboet commented Sep 10, 2025

@bors r=@tgross35

@bors
Copy link
Collaborator

bors commented Sep 10, 2025

📌 Commit 4c99219 has been approved by tgross35

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 10, 2025
bors added a commit that referenced this pull request Sep 12, 2025
std: optimize `dlsym!` macro and add a test for it

The `dlsym!` macro always ensures that the name string is nul-terminated, so there is no need to perform the check at runtime. Also, acquire loads are generally faster than a load and a barrier, so use them. This is only false in the case where the symbol is missing, but that shouldn't matter too much.
@bors
Copy link
Collaborator

bors commented Sep 12, 2025

⌛ Testing commit 4c99219 with merge 7e4208b...

@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-tools failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
..........................................         (142/142)
.
======== tests/rustdoc-gui/item-decl-colors.goml ========

[ERROR] `tests/rustdoc-gui/item-decl-colors.goml` line 23
    from `tests/rustdoc-gui/item-decl-colors.goml` line 42: Error: Navigating frame was detached: for command `go-to: "file://" + |DOC_PATH| + "/test_docs/struct.WithGenerics.html"`
`tests/rustdoc-gui/item-decl-colors.goml` item-decl-colors output:
Protocol error: Connection closed. Most likely the page has been closed.
stack: Error: Protocol error: Connection closed. Most likely the page has been closed.
    at assert (/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc-gui/node_modules/puppeteer-core/lib/cjs/puppeteer/util/assert.js:18:15)
    at CdpPage.close (/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc-gui/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/Page.js:814:36)
    at async runAllCommands (/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc-gui/node_modules/browser-ui-test/src/index.js:433:13)
    at async innerRunTestCode (/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc-gui/node_modules/browser-ui-test/src/index.js:696:21)
    at async innerRunTests (/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc-gui/node_modules/browser-ui-test/src/index.js:633:17)
    at async runTests (/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc-gui/node_modules/browser-ui-test/src/index.js:824:27)


======== tests/rustdoc-gui/item-decl-colors.goml ========

[ERROR] `tests/rustdoc-gui/item-decl-colors.goml` line 23
    from `tests/rustdoc-gui/item-decl-colors.goml` line 42: Error: Navigating frame was detached: for command `go-to: "file://" + |DOC_PATH| + "/test_docs/struct.WithGenerics.html"`
`tests/rustdoc-gui/item-decl-colors.goml` item-decl-colors output:
Protocol error: Connection closed. Most likely the page has been closed.
stack: Error: Protocol error: Connection closed. Most likely the page has been closed.
    at assert (/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc-gui/node_modules/puppeteer-core/lib/cjs/puppeteer/util/assert.js:18:15)
    at CdpPage.close (/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc-gui/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/Page.js:814:36)
    at async runAllCommands (/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc-gui/node_modules/browser-ui-test/src/index.js:433:13)
    at async innerRunTestCode (/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc-gui/node_modules/browser-ui-test/src/index.js:696:21)
    at async innerRunTests (/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc-gui/node_modules/browser-ui-test/src/index.js:633:17)
    at async runTests (/checkout/obj/build/x86_64-unknown-linux-gnu/test/rustdoc-gui/node_modules/browser-ui-test/src/index.js:824:27)


======== tests/rustdoc-gui/search-result-display.goml ========

[WARNING] `tests/rustdoc-gui/search-result-display.goml` line 39: Delta is 0 for "x", maybe try to use `compare-elements-position` instead?

@bors
Copy link
Collaborator

bors commented Sep 12, 2025

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Sep 12, 2025
@tgross35
Copy link
Contributor

Looks spurious?
@bors retry

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 12, 2025
@Zalathar
Copy link
Contributor

Bumping this above iffy PRs in case the rollup fails.

@bors p=1

@bors
Copy link
Collaborator

bors commented Sep 12, 2025

⌛ Testing commit 4c99219 with merge ac4495a...

@bors
Copy link
Collaborator

bors commented Sep 12, 2025

☀️ Test successful - checks-actions
Approved by: tgross35
Pushing ac4495a to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Sep 12, 2025
@bors bors merged commit ac4495a into rust-lang:master Sep 12, 2025
12 checks passed
@rustbot rustbot added this to the 1.91.0 milestone Sep 12, 2025
Copy link
Contributor

What is this? This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.

Comparing 8e2ed71 (parent) -> ac4495a (this PR)

Test differences

Show 6 test diffs

Stage 1

  • sys::pal::unix::weak::tests::dlsym_existing: [missing] -> pass (J0)
  • sys::pal::unix::weak::tests::dlsym_missing: [missing] -> pass (J0)

Stage 2

  • sys::pal::unix::weak::tests::dlsym_existing: [missing] -> pass (J1)
  • sys::pal::unix::weak::tests::dlsym_missing: [missing] -> pass (J1)

Additionally, 2 doctest diffs were found. These are ignored, as they are noisy.

Job group index

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard ac4495a10db552483c0c0a0049962850ca4123c2 --output-dir test-dashboard

And then open test-dashboard/index.html in your browser to see an overview of all executed tests.

Job duration changes

  1. pr-check-1: 1852.4s -> 1380.9s (-25.5%)
  2. x86_64-rust-for-linux: 3059.6s -> 2518.7s (-17.7%)
  3. i686-gnu-2: 6265.8s -> 5428.1s (-13.4%)
  4. x86_64-gnu-llvm-20-1: 3691.5s -> 3227.7s (-12.6%)
  5. aarch64-msvc-2: 4828.0s -> 5311.6s (10.0%)
  6. aarch64-gnu-debug: 4309.7s -> 3886.5s (-9.8%)
  7. i686-gnu-nopt-1: 8001.4s -> 7222.9s (-9.7%)
  8. x86_64-gnu-llvm-19-2: 6173.8s -> 5573.6s (-9.7%)
  9. aarch64-apple: 6738.2s -> 6117.5s (-9.2%)
  10. aarch64-gnu-llvm-19-2: 2530.2s -> 2302.2s (-9.0%)
How to interpret the job duration changes?

Job durations can vary a lot, based on the actual runner instance
that executed the job, system noise, invalidated caches, etc. The table above is provided
mostly for t-infra members, for simpler debugging of potential CI slow-downs.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (ac4495a): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results (primary -2.5%, secondary 3.5%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
3.5% [2.8%, 5.0%] 3
Improvements ✅
(primary)
-2.5% [-2.5%, -2.5%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -2.5% [-2.5%, -2.5%] 1

Cycles

Results (primary -3.2%, secondary -3.6%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-3.2% [-3.2%, -3.2%] 1
Improvements ✅
(secondary)
-3.6% [-6.6%, -2.2%] 8
All ❌✅ (primary) -3.2% [-3.2%, -3.2%] 1

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 467.415s -> 465.228s (-0.47%)
Artifact size: 387.84 MiB -> 387.86 MiB (0.01%)

github-actions bot pushed a commit to model-checking/verify-rust-std that referenced this pull request Oct 9, 2025
std: optimize `dlsym!` macro and add a test for it

The `dlsym!` macro always ensures that the name string is nul-terminated, so there is no need to perform the check at runtime. Also, acquire loads are generally faster than a load and a barrier, so use them. This is only false in the case where the symbol is missing, but that shouldn't matter too much.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merged-by-bors This PR was explicitly merged by bors. O-unix Operating system: Unix-like S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants