Add BenchmarkGenerateMaxSequence func
This allows a benchmark showing how fast ids can be generated with 21 bits assigned to the sequence number
This commit is contained in:
parent
0de6e0c074
commit
267d02f8b9
@ -169,6 +169,20 @@ func BenchmarkGenerate(b *testing.B) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func BenchmarkGenerateMaxSequence(b *testing.B) {
|
||||||
|
|
||||||
|
NodeBits = 1
|
||||||
|
StepBits = 21
|
||||||
|
node, _ := NewNode(1)
|
||||||
|
|
||||||
|
b.ReportAllocs()
|
||||||
|
|
||||||
|
b.ResetTimer()
|
||||||
|
for n := 0; n < b.N; n++ {
|
||||||
|
_ = node.Generate()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func BenchmarkUnmarshal(b *testing.B) {
|
func BenchmarkUnmarshal(b *testing.B) {
|
||||||
// Generate the ID to unmarshal
|
// Generate the ID to unmarshal
|
||||||
node, _ := NewNode(1)
|
node, _ := NewNode(1)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user