Skip to content

Conversation

clipperhouse
Copy link

Hi Seth! Nice work here. I am working on a new Go rate limiter and would like to add to your benchmarks.

My local run:

go test -bench=.
goos: darwin
goarch: arm64
pkg: github.com/sethvargo/go-limiter/benchmarks
cpu: Apple M2
BenchmarkClipperhouseMemory/memory/serial-8  	15701103	        76.72 ns/op	       0 B/op	       0 allocs/op
BenchmarkClipperhouseMemory/memory/parallel-8         	51872358	        21.91 ns/op	       0 B/op	       0 allocs/op
BenchmarkSethVargoMemory/memory/serial-8              	20293608	        58.64 ns/op
BenchmarkSethVargoMemory/memory/parallel-8            	10464970	       114.5 ns/op
BenchmarkSethVargoMemory/sweep/serial-8               	19953289	        58.98 ns/op
BenchmarkSethVargoMemory/sweep/parallel-8             	10245894	       116.1 ns/op
--- FAIL: BenchmarkSethVargoRedis
    sethvargo_test.go:101: missing REDIS_HOST
BenchmarkThrottled/memory/serial-8                    	13697444	        87.68 ns/op
BenchmarkThrottled/memory/parallel-8                  	 6532964	       183.1 ns/op
BenchmarkThrottled/sweep/serial-8                     	14031770	        85.76 ns/op
BenchmarkThrottled/sweep/parallel-8                   	 9576992	       125.2 ns/op
BenchmarkTollbooth/memory/serial-8                    	 5704026	       211.0 ns/op
BenchmarkTollbooth/memory/parallel-8                  	 3270052	       367.9 ns/op
BenchmarkTollbooth/sweep/serial-8                     	 4262370	       299.1 ns/op
BenchmarkTollbooth/sweep/parallel-8                   	 2586741	       457.4 ns/op
BenchmarkUber/memory/serial-8                         	21398766	        53.33 ns/op
BenchmarkUber/memory/parallel-8                       	 4962492	       252.1 ns/op
BenchmarkUlule/memory/serial-8                        	 7339310	       144.9 ns/op
BenchmarkUlule/memory/parallel-8                      	 8083900	       161.7 ns/op

If this PR interests you, you’ll want to run your own benchmarks (I didn’t bother with Redis).

And, go.mod has some unrelated changes, feel free to accept or reject. Cheers.

@clipperhouse clipperhouse force-pushed the clipperhouse-benchmarks branch from 5227903 to 99cba3d Compare August 13, 2025 19:03
@clipperhouse
Copy link
Author

Update to latest version of clipperhouse/rate. Let me know if interested @sethvargo. Cheers.

goos: darwin
goarch: arm64
pkg: github.com/sethvargo/go-limiter/benchmarks
cpu: Apple M2
BenchmarkClipperhouseMemory/memory/serial-8  	29023738	        41.93 ns/op	       0 B/op	       0 allocs/op
BenchmarkClipperhouseMemory/memory/parallel-8         	87043773	        13.82 ns/op	       0 B/op	       0 allocs/op
BenchmarkSethVargoMemory/memory/serial-8              	20131807	        59.23 ns/op
BenchmarkSethVargoMemory/memory/parallel-8            	10264122	       115.6 ns/op
BenchmarkSethVargoMemory/sweep/serial-8               	19818181	        59.96 ns/op
BenchmarkSethVargoMemory/sweep/parallel-8             	10199827	       117.4 ns/op
--- FAIL: BenchmarkSethVargoRedis
    sethvargo_test.go:101: missing REDIS_HOST
BenchmarkThrottled/memory/serial-8                    	13592701	        87.89 ns/op
BenchmarkThrottled/memory/parallel-8                  	 5915017	       202.6 ns/op
BenchmarkThrottled/sweep/serial-8                     	13921423	        85.86 ns/op
BenchmarkThrottled/sweep/parallel-8                   	 9530623	       125.0 ns/op
BenchmarkTollbooth/memory/serial-8                    	 5643465	       212.1 ns/op
BenchmarkTollbooth/memory/parallel-8                  	 3293569	       365.7 ns/op
BenchmarkTollbooth/sweep/serial-8                     	 4257783	       281.6 ns/op
BenchmarkTollbooth/sweep/parallel-8                   	 2549242	       467.2 ns/op
BenchmarkUber/memory/serial-8                         	22668900	        52.74 ns/op
BenchmarkUber/memory/parallel-8                       	 4895458	       237.9 ns/op
BenchmarkUlule/memory/serial-8                        	 8318709	       144.0 ns/op
BenchmarkUlule/memory/parallel-8                      	 7856142	       168.6 ns/op

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.

1 participant