Skip to content

fix: reduce allocations in or_insert and get_or_insert - #6136

Merged
jxs merged 11 commits into
libp2p:masterfrom
hanabi1224:reduce-allocations-or-insert
Sep 8, 2025
Merged

fix: reduce allocations in or_insert and get_or_insert#6136
jxs merged 11 commits into
libp2p:masterfrom
hanabi1224:reduce-allocations-or-insert

Conversation

@hanabi1224

@hanabi1224 hanabi1224 commented Aug 13, 2025

Copy link
Copy Markdown
Contributor

Description

This PR tries to reduce allocations in a few places by replacing (get)_or_insert with (get)_or_insert_with

Notes & open questions

Change checklist

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • A changelog entry has been made in the appropriate crates

@hanabi1224
hanabi1224 marked this pull request as ready for review August 13, 2025 02:53
elenaf9
elenaf9 previously approved these changes Aug 13, 2025

@elenaf9 elenaf9 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

@hanabi1224
hanabi1224 force-pushed the reduce-allocations-or-insert branch from ac82c0c to 3b593d3 Compare August 13, 2025 07:12
Comment thread transports/webrtc/Cargo.toml Outdated
@mergify
mergify Bot dismissed elenaf9’s stale review August 20, 2025 12:19

Approvals have been dismissed because the PR was updated after the send-it label was applied.

@drHuangMHT

Copy link
Copy Markdown
Contributor

@elenaf9 need a merge from master that resolves the conflict and then re-approve

@hanabi1224

Copy link
Copy Markdown
Contributor Author

@elenaf9 need a merge from master that resolves the conflict and then re-approve

@drHuangMHT merge conflict resolved

elenaf9
elenaf9 previously approved these changes Aug 26, 2025
@drHuangMHT

Copy link
Copy Markdown
Contributor

libp2p-webrtc check is reporting a semver issue. @elenaf9 maybe we should also refresh the tag(re-tag the send-it) so that the bot will notice.

@elenaf9

elenaf9 commented Aug 28, 2025

Copy link
Copy Markdown
Member

libp2p-webrtc check is reporting a semver issue. @elenaf9 maybe we should also refresh the tag(re-tag the send-it) so that the bot will notice.

See #6136 (comment). Check is required but failing due to a bug in the CI script. I've discuss it with @jxs out-of-band, he'll do a manual merge.

@mergify
mergify Bot dismissed elenaf9’s stale review September 8, 2025 14:12

Approvals have been dismissed because the PR was updated after the send-it label was applied.

@jxs
jxs merged commit 6e18dd4 into libp2p:master Sep 8, 2025
66 of 68 checks passed
@hanabi1224
hanabi1224 deleted the reduce-allocations-or-insert branch September 9, 2025 08:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants