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

improve performance #12

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

improve performance #12

wants to merge 7 commits into from

Conversation

paulwe
Copy link

@paulwe paulwe commented Jun 10, 2023

add the improvement to getAltIndex by @MeteorsLiu from their abandoned pr.

simplify getNextPow2

use a per filter rng for randi to avoid contention

preallocate temporary read/write buffer in encode/decode

pack buckets into uint64

before

goos: darwin
goarch: arm64
pkg: github.com/panmari/cuckoofilter
BenchmarkFilter_Reset
BenchmarkFilter_Reset-10     	  133612	      8374 ns/op	       0 B/op	       0 allocs/op
BenchmarkFilter_Insert
BenchmarkFilter_Insert-10    	54015536	        22.35 ns/op	       0 B/op	       0 allocs/op
BenchmarkFilter_Lookup
BenchmarkFilter_Lookup-10    	68751163	        17.63 ns/op	       0 B/op	       0 allocs/op
PASS

after

goos: darwin
goarch: arm64
pkg: github.com/panmari/cuckoofilter
BenchmarkFilter_Reset
BenchmarkFilter_Reset-10     	  885447	      1340 ns/op	       0 B/op	       0 allocs/op
BenchmarkFilter_Insert
BenchmarkFilter_Insert-10    	140478770	         8.548 ns/op	       0 B/op	       0 allocs/op
BenchmarkFilter_Lookup
BenchmarkFilter_Lookup-10    	120644037	         9.868 ns/op	       0 B/op	       0 allocs/op

@MeteorsLiu
Copy link

I'm sorry that i forgot the pr.
Because i infected the COVID-19 in that time, when i recovered from it, i forgot it...

@paulwe paulwe force-pushed the master branch 4 times, most recently from 391231c to 8b08a44 Compare June 12, 2023 09:53
@paulwe
Copy link
Author

paulwe commented Jun 12, 2023

@MeteorsLiu i'm sorry to hear that. i hope you're feeling better now! i added you as a coauthor to the diff i based on your work.

@panmari
Copy link
Owner

panmari commented Jun 22, 2023

Thanks for putting together! With everything in one big pull requests, it's hard to evaluate how much each change individually contributes.

Could you please send individual PRs for all the changes you're making? That would immensely help with reviewing!

@paulwe
Copy link
Author

paulwe commented Jun 23, 2023

bfbb4b4 improves insert and lookup from 22 and 17 to 17 and 12 ns
88c5449 reduces allocations during import/export from one per fingerprint to one
c94c7db reduces reset from 8370 to 1340 and insert and lookup from 17 and 12 to 8.5 and 9.9 ns

lizthegrey added a commit to honeycombio/refinery that referenced this pull request Jun 30, 2023
bucket.go Outdated Show resolved Hide resolved
@paulwe paulwe force-pushed the master branch 2 times, most recently from c94c7db to ef34862 Compare July 8, 2023 00:53
@mfreeman451
Copy link

@paulwe do you have a fork that is good to use?

@paulwe
Copy link
Author

paulwe commented Aug 18, 2024

@mfreeman451 https://github.com/livekit/cuckoofilter

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.

5 participants