Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fix BenchmarkCacheSetDeleteSingleLock 'cheating' by unintentionally o…

…nly locking once in the whole benchmark, rather than once per set and delete
  • Loading branch information...
commit 0f0584a8050f2a622cea755a3c6b07c034ef182a 1 parent 0a962bf
Patrick Mylund Nielsen authored

Showing 1 changed file with 2 additions and 2 deletions. Show diff stats Hide diff stats

  1. 4  cache_test.go
4  cache_test.go
@@ -735,12 +735,12 @@ func BenchmarkMutexMapSetDelete(b *testing.B) {
735 735
 
736 736
 func BenchmarkCacheSetDeleteSingleLock(b *testing.B) {
737 737
 	tc := New(0, 0)
738  
-	tc.mu.Lock()
739 738
 	for i := 0; i < b.N; i++ {
  739
+		tc.mu.Lock()
740 740
 		tc.set("foo", "bar", 0)
741 741
 		tc.delete("foo")
  742
+		tc.mu.Unlock()
742 743
 	}
743  
-	tc.mu.Unlock()
744 744
 }
745 745
 
746 746
 func BenchmarkMutexMapSetDeleteSingleLock(b *testing.B) {

0 notes on commit 0f0584a

Please sign in to comment.
Something went wrong with that request. Please try again.