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

modified freelist_hmap/hashmapGetFreePageIDs with better performance #419

Merged
merged 1 commit into from
Mar 15, 2023

Conversation

cenkalti
Copy link
Member

Resurrected #219

@@ -434,3 +434,27 @@ func newTestFreelist() *freelist {

return newFreelist(freelistType)
}

func Test_freelist_hashmapGetFreePageIDs(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

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

Can you please implement a microbenchmark an use benchstat to show performance improvement. Article shows how properly use it.

Sorry for being a stickler, but from my experience it's easy to make mistakes when optimizing and we need to standardize the process for writing performance improvement PRs.

Copy link
Member Author

@cenkalti cenkalti Mar 15, 2023

Choose a reason for hiding this comment

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

benchmark                                       old ns/op     new ns/op     delta
Benchmark_freelist_hashmapGetFreePageIDs-12     21804519      181847        -99.17%

benchmark                                       old allocs     new allocs     delta
Benchmark_freelist_hashmapGetFreePageIDs-12     2              3              +50.00%

benchmark                                       old bytes     new bytes     delta
Benchmark_freelist_hashmapGetFreePageIDs-12     802886        812828        +1.24%

@cenkalti cenkalti force-pushed the freelist_hmap branch 2 times, most recently from cce63f8 to f6ccf09 Compare March 15, 2023 03:04
Signed-off-by: Cenk Alti <cenkalti@gmail.com>
Copy link
Member

@ahrtr ahrtr left a comment

Choose a reason for hiding this comment

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

LGTM

Thank you @cenkalti

Copy link
Member

@serathius serathius left a comment

Choose a reason for hiding this comment

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

99% time reduction for 1 alloc. Nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants