Skip to content

improve performance - #12

Open
paulwe wants to merge 7 commits into
panmari:masterfrom
livekit:master
Open

improve performance#12
paulwe wants to merge 7 commits into
panmari:masterfrom
livekit:master

Conversation

@paulwe

@paulwe paulwe commented Jun 10, 2023

Copy link
Copy Markdown

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
Copy Markdown

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

paulwe commented Jun 12, 2023

Copy link
Copy Markdown
Author

@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.

paulwe and others added 3 commits June 12, 2023 07:59
Co-authored-by: Meteor <17515813+MeteorsLiu@users.noreply.github.com>
@panmari

panmari commented Jun 22, 2023

Copy link
Copy Markdown
Owner

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

paulwe commented Jun 23, 2023

Copy link
Copy Markdown
Author

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
Comment thread bucket.go Outdated
@paulwe
paulwe force-pushed the master branch 2 times, most recently from c94c7db to ef34862 Compare July 8, 2023 00:53
@mfreeman451

Copy link
Copy Markdown

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

@paulwe

paulwe commented Aug 18, 2024

Copy link
Copy Markdown
Author

@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