Last active
June 11, 2021 07:12
-
-
Save jeromewu/4f8c39db49e90dc39446cd4fc4727906 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"testing" | |
) | |
const it = uint(1 << 24) | |
func BenchmarkSetWithBoolValueWrite(b *testing.B) { | |
set := make(map[uint]bool) | |
for i := uint(0); i < it; i++ { | |
set[i] = true | |
} | |
} | |
func BenchmarkSetWithStructValueWrite(b *testing.B) { | |
set := make(map[uint]struct{}) | |
for i := uint(0); i < it; i++ { | |
set[i] = struct{}{} | |
} | |
} | |
func BenchmarkSetWithInterfaceValueWrite(b *testing.B) { | |
set := make(map[uint]interface{}) | |
for i := uint(0); i < it; i++ { | |
set[i] = struct{}{} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment