File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -30,10 +30,12 @@ func BenchmarkPush(b *testing.B) {
3030 }
3131 b .ResetTimer ()
3232 b .StartTimer ()
33+ var total int64 = 0
3334 for i := 0 ; i < b .N ; i ++ {
3435 l := rand .Intn (256 ) + 8
3536 p = ptr [:l ]
36- b .SetBytes (int64 (l ))
37+ total += int64 (len (p ))
38+
3739 binary .LittleEndian .PutUint32 (p , uint32 (i ))
3840 binary .LittleEndian .PutUint32 (p [4 :], uint32 (l ))
3941
@@ -55,14 +57,16 @@ func BenchmarkPop(b *testing.B) {
5557 panic (err )
5658 }
5759 defer fq .Close ()
60+ defer os .RemoveAll (fpath )
5861 b .ResetTimer ()
5962 b .StartTimer ()
63+ var total int64 = 0
6064 for i := 0 ; i < b .N ; i ++ {
6165 if p , err = fq .Pop (); err != nil {
6266 b .FailNow ()
6367 return
6468 }
65- b . SetBytes ( int64 (len (p ) ))
69+ total += int64 (len (p ))
6670 c := int (binary .LittleEndian .Uint32 (p ))
6771 l := int (binary .LittleEndian .Uint32 (p [4 :]))
6872 if c != i || l != len (p ) {
Original file line number Diff line number Diff line change @@ -32,10 +32,11 @@ func BenchmarkJournalQueuePush(b *testing.B) {
3232 }
3333 b .ResetTimer ()
3434 b .StartTimer ()
35+ var total int64 = 0
3536 for i := 0 ; i < b .N ; i ++ {
3637 l := rand .Intn (256 ) + 8
3738 p = ptr [:l ]
38- b . SetBytes ( int64 (l ))
39+ total += int64 (len ( p ))
3940 binary .LittleEndian .PutUint32 (p , uint32 (i ))
4041 binary .LittleEndian .PutUint32 (p [4 :], uint32 (l ))
4142
@@ -57,14 +58,16 @@ func BenchmarkJournalQueuePop(b *testing.B) {
5758 panic (err )
5859 }
5960 defer fq .Close ()
61+ defer os .RemoveAll (fpath )
6062 b .ResetTimer ()
6163 b .StartTimer ()
64+ var total int64 = 0
6265 for i := 0 ; i < b .N ; i ++ {
6366 if p , err = fq .Pop (); err != nil {
6467 b .FailNow ()
6568 return
6669 }
67- b . SetBytes ( int64 (len (p ) ))
70+ total += int64 (len (p ))
6871 c := int (binary .LittleEndian .Uint32 (p ))
6972 l := int (binary .LittleEndian .Uint32 (p [4 :]))
7073 if c != i || l != len (p ) {
You can’t perform that action at this time.
0 commit comments