-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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: fix addressbook benchmark timing #3092
Open
sukunrt
wants to merge
1
commit into
master
Choose a base branch
from
sukun/peerstore-bms
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains 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
The previous code was not accounting accurately for the time spent generating test cases. In the benchmark output below the difference between 100 address per peer suite is huge: BenchmarkInMemoryPeerstore/SetAddrs-100Addrs-InMem-16 10000 190198 ns/op vs BenchmarkInMemoryPeerstore/SetAddrs-100-16 10000 42710 ns/op old benchmark: ``` goos: linux goarch: amd64 pkg: github.com/libp2p/go-libp2p/p2p/host/peerstore/pstoremem cpu: AMD Ryzen 7 7840U w/ Radeon 780M Graphics BenchmarkInMemoryPeerstore BenchmarkInMemoryPeerstore/AddAddrs-1Addrs-InMem BenchmarkInMemoryPeerstore/AddAddrs-1Addrs-InMem-16 10000 4158 ns/op BenchmarkInMemoryPeerstore/AddAddrs-10Addrs-InMem BenchmarkInMemoryPeerstore/AddAddrs-10Addrs-InMem-16 10000 26364 ns/op BenchmarkInMemoryPeerstore/AddAddrs-100Addrs-InMem BenchmarkInMemoryPeerstore/AddAddrs-100Addrs-InMem-16 10000 197692 ns/op BenchmarkInMemoryPeerstore/AddGetAndClearAddrs-1Addrs-InMem BenchmarkInMemoryPeerstore/AddGetAndClearAddrs-1Addrs-InMem-16 10000 3692 ns/op BenchmarkInMemoryPeerstore/AddGetAndClearAddrs-10Addrs-InMem BenchmarkInMemoryPeerstore/AddGetAndClearAddrs-10Addrs-InMem-16 10000 23182 ns/op BenchmarkInMemoryPeerstore/AddGetAndClearAddrs-100Addrs-InMem BenchmarkInMemoryPeerstore/AddGetAndClearAddrs-100Addrs-InMem-16 10000 202959 ns/op BenchmarkInMemoryPeerstore/Get1000PeersWithAddrs-1Addrs-InMem BenchmarkInMemoryPeerstore/Get1000PeersWithAddrs-1Addrs-InMem-16 10000 25348 ns/op BenchmarkInMemoryPeerstore/Get1000PeersWithAddrs-10Addrs-InMem BenchmarkInMemoryPeerstore/Get1000PeersWithAddrs-10Addrs-InMem-16 10000 20133 ns/op BenchmarkInMemoryPeerstore/Get1000PeersWithAddrs-100Addrs-InMem BenchmarkInMemoryPeerstore/Get1000PeersWithAddrs-100Addrs-InMem-16 10000 17525 ns/op BenchmarkInMemoryPeerstore/GetAddrs-1Addrs-InMem BenchmarkInMemoryPeerstore/GetAddrs-1Addrs-InMem-16 10000 163.5 ns/op BenchmarkInMemoryPeerstore/GetAddrs-10Addrs-InMem BenchmarkInMemoryPeerstore/GetAddrs-10Addrs-InMem-16 10000 203.9 ns/op BenchmarkInMemoryPeerstore/GetAddrs-100Addrs-InMem BenchmarkInMemoryPeerstore/GetAddrs-100Addrs-InMem-16 10000 1696 ns/op BenchmarkInMemoryPeerstore/SetAddrs-1Addrs-InMem BenchmarkInMemoryPeerstore/SetAddrs-1Addrs-InMem-16 10000 3431 ns/op BenchmarkInMemoryPeerstore/SetAddrs-10Addrs-InMem BenchmarkInMemoryPeerstore/SetAddrs-10Addrs-InMem-16 10000 21599 ns/op BenchmarkInMemoryPeerstore/SetAddrs-100Addrs-InMem BenchmarkInMemoryPeerstore/SetAddrs-100Addrs-InMem-16 10000 190198 ns/op ``` new benchmark: ``` goos: linux goarch: amd64 pkg: github.com/libp2p/go-libp2p/p2p/host/peerstore/pstoremem cpu: AMD Ryzen 7 7840U w/ Radeon 780M Graphics BenchmarkInMemoryPeerstore BenchmarkInMemoryPeerstore/AddAddrs-1 BenchmarkInMemoryPeerstore/AddAddrs-1-16 10000 899.2 ns/op BenchmarkInMemoryPeerstore/GetAddrs-1 BenchmarkInMemoryPeerstore/GetAddrs-1-16 10000 914.9 ns/op BenchmarkInMemoryPeerstore/GetAndClearAddrs-1 BenchmarkInMemoryPeerstore/GetAndClearAddrs-1-16 10000 699.5 ns/op BenchmarkInMemoryPeerstore/PeersWithAddrs-1 BenchmarkInMemoryPeerstore/PeersWithAddrs-1-16 10000 112298 ns/op BenchmarkInMemoryPeerstore/SetAddrs-1 BenchmarkInMemoryPeerstore/SetAddrs-1-16 10000 764.7 ns/op BenchmarkInMemoryPeerstore/AddAddrs-10 BenchmarkInMemoryPeerstore/AddAddrs-10-16 10000 4682 ns/op BenchmarkInMemoryPeerstore/GetAddrs-10 BenchmarkInMemoryPeerstore/GetAddrs-10-16 10000 5310 ns/op BenchmarkInMemoryPeerstore/GetAndClearAddrs-10 BenchmarkInMemoryPeerstore/GetAndClearAddrs-10-16 10000 4147 ns/op BenchmarkInMemoryPeerstore/PeersWithAddrs-10 BenchmarkInMemoryPeerstore/PeersWithAddrs-10-16 10000 93408 ns/op BenchmarkInMemoryPeerstore/SetAddrs-10 BenchmarkInMemoryPeerstore/SetAddrs-10-16 10000 4412 ns/op BenchmarkInMemoryPeerstore/AddAddrs-100 BenchmarkInMemoryPeerstore/AddAddrs-100-16 10000 40847 ns/op BenchmarkInMemoryPeerstore/GetAddrs-100 BenchmarkInMemoryPeerstore/GetAddrs-100-16 10000 40197 ns/op BenchmarkInMemoryPeerstore/GetAndClearAddrs-100 BenchmarkInMemoryPeerstore/GetAndClearAddrs-100-16 10000 37848 ns/op BenchmarkInMemoryPeerstore/PeersWithAddrs-100 BenchmarkInMemoryPeerstore/PeersWithAddrs-100-16 10000 111613 ns/op BenchmarkInMemoryPeerstore/SetAddrs-100 BenchmarkInMemoryPeerstore/SetAddrs-100-16 10000 42710 ns/op ```
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.
The previous code was not accounting accurately for the time spent generating test cases. In the benchmark output below the difference between 100 address per peer suite is huge:
old benchmark:
new benchmark: