Skip to content

Commit

Permalink
Small dead code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
object88 committed Jan 10, 2017
1 parent 18e9f89 commit 7f27829
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 15 deletions.
12 changes: 1 addition & 11 deletions hashmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ type HashMap struct {
}

const (
// lobSize = 3
bucketCapacity = 1 << 3 //lobSize
bucketCapacity = 1 << 3
loadFactor = 6.0
)

Expand Down Expand Up @@ -71,13 +70,6 @@ func (h *HashMap) Get(key Key) Value {
// fmt.Printf("hashKey: 0x%016x / selectedBucket: %d / mashedHash: 0x%016x\n", hashkey, selectedBucket, maskedHash)

for b != nil {
// fmt.Printf(" entryCount: %d\n", b.entryCount)
// fmt.Printf(" entries: [\n")
// for i := uint64(0); i < uint64(b.entryCount); i++ {
// fmt.Printf(" [0x%016x,%s] -> %s\n", b.hobs.Read(i), b.entries[i].key, b.entries[i].value)
// }
// fmt.Printf(" ]\n")

for index := uint64(0); index < totalEntries; index++ {
// fmt.Printf("0x%016x <-> 0x%016x :: %s <-> %s\n", b.hobs.Read(index), maskedHash, b.entries[index].key, key)
if b.hobs.Read(index) == maskedHash && b.entries[index].key == key {
Expand Down Expand Up @@ -287,8 +279,6 @@ func createHashMap(size int, options *HashMapOptions) *HashMap {
lobMask := uint32(^(0xffffffff << lobSize))
buckets := make([]*bucket, initialSize)

// fmt.Printf("lobSize: %d; lobMask: 0x%032b\n", lobSize, lobMask)

src := rand.NewSource(time.Now().UnixNano())
random := rand.New(src)
seed := uint32(random.Int31())
Expand Down
2 changes: 0 additions & 2 deletions hashmap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,6 @@ func Test_Hashmap_ReadAndWriteLargeDataSet(t *testing.T) {
}

original := NewHashMap(contents, nil)
// fmt.Printf("%#v\n", original)
// for k, v := range contents {
for i := 0; i < max; i++ {
k := IntKey(i)
result := original.Get(k)
Expand Down
2 changes: 0 additions & 2 deletions memory/constants.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package memory

const (
// allUint32bits = ^uint32(0)
bitsInExtraLargeBlock = 64
bitsInLargeBlock = 32
bitsInSmallBlock = 8
// bitsInBlock = uint32(unsafe.Sizeof(uint32(0)) * bitsInSmallBlock)
)

0 comments on commit 7f27829

Please sign in to comment.