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 the performance of the Memory store #127

Merged
merged 7 commits into from
Dec 4, 2020
Merged

Conversation

novln
Copy link
Contributor

@novln novln commented Nov 17, 2020

This pull request tries to tackle performance issues reported with the memory store (It should close #86).

For comparison, this is the benchmark on master branch:

➤ go test -v -benchtime=40s -run=XXX -benchmem -bench .
goos: linux
goarch: amd64
pkg: github.com/ulule/limiter/v3/drivers/store/memory
BenchmarkRedisStoreSequentialAccess
BenchmarkRedisStoreSequentialAccess-4   	106805974	      396 ns/op	     80 B/op	      3 allocs/op
BenchmarkRedisStoreConcurrentAccess
BenchmarkRedisStoreConcurrentAccess-4   	127844050	      398 ns/op	     80 B/op	      3 allocs/op
PASS

And the benchmark with these improvements:

➤ go test -v -benchtime=40s -run=XXX -benchmem -bench .
goos: linux
goarch: amd64
pkg: github.com/ulule/limiter/v3/drivers/store/memory
BenchmarkMemoryStoreSequentialAccess
BenchmarkMemoryStoreSequentialAccess-4   	167021902	      289 ns/op	      0 B/op	      0 allocs/op
BenchmarkMemoryStoreConcurrentAccess
BenchmarkMemoryStoreConcurrentAccess-4   	182060744	      309 ns/op	      0 B/op	      0 allocs/op
PASS

@novln novln requested a review from thoas November 17, 2020 11:19
drivers/store/memory/cache.go Show resolved Hide resolved
drivers/store/memory/cache.go Show resolved Hide resolved
drivers/store/memory/cache.go Show resolved Hide resolved
@thoas thoas merged commit a1ac111 into master Dec 4, 2020
@thoas thoas deleted the feat-memory-syncmap branch December 4, 2020 12:40
@thoas
Copy link
Member

thoas commented Dec 4, 2020

Great PR 👏

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.

Memory store clean command is a blocker
2 participants