func BenchmarkMutableIterate(b *testing.B) {
	testTreap := NewMutable()
	ticketKeys := genTicketKeys()
	for j := 0; j < len(ticketKeys); j++ {
		hashBytes := ticketKeys[j]
		value := &Value{Height: uint32(j)}
		testTreap.Put(hashBytes, value)
	}
	b.ReportAllocs()
	b.ResetTimer()
	for i := 0; i < b.N; i++ {
		testTreap.ForEach(func(k Key, v *Value) bool {
			return true
		})
	}
}
BenchmarkMutableCopy benchmarks how long it takes to iterate a mutable treap
when it contains 'numTicketKeys' entries.
package tickettreap
import (
	"crypto/sha256"
	"sync"
	"testing"
)
const numTicketKeys = 42500
var (
	genTicketKeysLock   sync.Mutex
	generatedTicketKeys []Key
)
func genTicketKeys() []Key {
	genTicketKeysLock.Lock()
	defer genTicketKeysLock.Unlock()
	if generatedTicketKeys != nil {
		return generatedTicketKeys
	}
	ticketKeys := make([]Key, 0, numTicketKeys)
	for i := 0; i < numTicketKeys; i++ {
		key := Key(sha256.Sum256(serializeUint32(uint32(i))))
		ticketKeys = append(ticketKeys, key)
	}
	generatedTicketKeys = ticketKeys
	return ticketKeys
}
func BenchmarkMutableCopy(b *testing.B) {
	testTreap := NewMutable()
	ticketKeys := genTicketKeys()
	for j := 0; j < len(ticketKeys); j++ {
		hashBytes := ticketKeys[j]
		value := &Value{Height: uint32(j)}
		testTreap.Put(hashBytes, value)
	}
	b.ReportAllocs()
	b.ResetTimer()
	var mtx sync.RWMutex
	for i := 0; i < b.N; i++ {
		benchTreap := NewMutable()
		mtx.Lock()
		testTreap.ForEach(func(k Key, v *Value) bool {
			benchTreap.Put(k, v)
			return true
		})
		mtx.Unlock()
	}
}
func BenchmarkImmutableCopy(b *testing.B) {
	testTreap := NewImmutable()
	ticketKeys := genTicketKeys()
	for j := 0; j < len(ticketKeys); j++ {
		hashBytes := ticketKeys[j]
		value := &Value{Height: uint32(j)}
		testTreap = testTreap.Put(hashBytes, value)
	}
	b.ReportAllocs()
	b.ResetTimer()
	var mtx sync.RWMutex
	for i := 0; i < b.N; i++ {
		mtx.RLock()
		benchTreap := testTreap
		mtx.RUnlock()
		_ = benchTreap
	}
}