File tree 3 files changed +5
-8
lines changed
3 files changed +5
-8
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ import (
10
10
"github.com/dgraph-io/ristretto/z"
11
11
)
12
12
13
- var wait time. Duration = time .Millisecond * 10
13
+ var wait = time .Millisecond * 10
14
14
15
15
func TestCacheKeyToHash (t * testing.T ) {
16
16
keyToHashCount := 0
@@ -305,10 +305,8 @@ func TestCacheSet(t *testing.T) {
305
305
if val , ok := c .Get (1 ); val == nil || val .(int ) != 1 || ! ok {
306
306
t .Fatal ("set/get returned wrong value" )
307
307
}
308
- } else {
309
- if val , ok := c .Get (1 ); val != nil || ok {
310
- t .Fatal ("set was dropped but value still added" )
311
- }
308
+ } else if val , ok := c .Get (1 ); val != nil || ok {
309
+ t .Fatal ("set was dropped but value still added" )
312
310
}
313
311
c .Set (1 , 2 , 2 )
314
312
val , ok := c .store .Get (z .KeyToHash (1 ))
Original file line number Diff line number Diff line change @@ -335,7 +335,7 @@ func (p *tinyLFU) Push(keys []uint64) {
335
335
func (p * tinyLFU ) Estimate (key uint64 ) int64 {
336
336
hits := p .freq .Estimate (key )
337
337
if p .door .Has (key ) {
338
- hits += 1
338
+ hits ++
339
339
}
340
340
return hits
341
341
}
Original file line number Diff line number Diff line change @@ -53,7 +53,6 @@ func SipHash(p []byte) (l, h uint64) {
53
53
54
54
// Compression.
55
55
for len (p ) >= 8 {
56
-
57
56
m := uint64 (p [0 ]) | uint64 (p [1 ])<< 8 | uint64 (p [2 ])<< 16 | uint64 (p [3 ])<< 24 |
58
57
uint64 (p [4 ])<< 32 | uint64 (p [5 ])<< 40 | uint64 (p [6 ])<< 48 | uint64 (p [7 ])<< 56
59
58
@@ -252,8 +251,8 @@ func SipHash(p []byte) (l, h uint64) {
252
251
h = hash >> 1
253
252
l = hash << 1 >> 1
254
253
return l , h
255
-
256
254
}
255
+
257
256
func BenchmarkNanoTime (b * testing.B ) {
258
257
for i := 0 ; i < b .N ; i ++ {
259
258
NanoTime ()
You can’t perform that action at this time.
0 commit comments