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

peerstore: remove sync.Pool for expiringAddrs #3093

Open
wants to merge 2 commits into
base: sukun/peerstore-bms
Choose a base branch
from

Conversation

sukunrt
Copy link
Member

@sukunrt sukunrt commented Dec 8, 2024

depends on #3092

My intuition here was way off. The method spends most of the time either doing multiaddr ops or manipulating the heap(see the flamegraph). We don't need the sync.Pool. There's only a 5% difference without the pool.

goos: linux
goarch: amd64
pkg: github.com/libp2p/go-libp2p/p2p/host/peerstore/pstoremem
cpu: AMD Ryzen 7 7840U w/ Radeon  780M Graphics     
                                          │   old.txt   │              new.txt               │
                                          │   sec/op    │   sec/op     vs base               │
InMemoryPeerstore/GetAndClearAddrs-1-16     8.351µ ± 2%   8.711µ ± 6%  +4.31% (p=0.019 n=10)
InMemoryPeerstore/GetAndClearAddrs-10-16    49.04µ ± 1%   49.75µ ± 1%  +1.45% (p=0.000 n=10)
InMemoryPeerstore/GetAndClearAddrs-100-16   462.6µ ± 1%   495.5µ ± 3%  +7.10% (p=0.000 n=10)
geomean                                     57.44µ        59.88µ       +4.26%

addrbook-bm

@sukunrt sukunrt requested a review from MarcoPolo December 8, 2024 08:52
@sukunrt sukunrt self-assigned this Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant