mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-05 08:10:50 +00:00
commit
46ca04afab
4 changed files with 39 additions and 7 deletions
10
Gopkg.lock
generated
10
Gopkg.lock
generated
|
|
@ -37,6 +37,12 @@
|
|||
revision = "2f1ce7a837dcb8da3ec595b1dac9d0632f0f99e8"
|
||||
version = "v1.3.1"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/cespare/xxhash"
|
||||
packages = ["."]
|
||||
revision = "5c37fe3735342a2e0d01c87a907579987c8936cc"
|
||||
version = "v1.0.0"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/davecgh/go-spew"
|
||||
packages = ["spew"]
|
||||
|
|
@ -189,7 +195,7 @@
|
|||
|
||||
[[projects]]
|
||||
name = "github.com/shirou/gopsutil"
|
||||
packages = ["host","internal/common","mem","process"]
|
||||
packages = ["cpu","host","internal/common","mem","net","process"]
|
||||
revision = "bfe3c2e8f406bf352bc8df81f98c752224867349"
|
||||
version = "v2.17.11"
|
||||
|
||||
|
|
@ -268,6 +274,6 @@
|
|||
[solve-meta]
|
||||
analyzer-name = "dep"
|
||||
analyzer-version = 1
|
||||
inputs-digest = "d91110a10c830f7a9cc439b9578840d97d9921e84d08242316da8d4a18c68c56"
|
||||
inputs-digest = "53ae0cdcbfa8419b233a0544d7ebb80614af3dd04bebdc0c8f2d3620a87efa91"
|
||||
solver-name = "gps-cdcl"
|
||||
solver-version = 1
|
||||
|
|
|
|||
6
attr.go
6
attr.go
|
|
@ -16,13 +16,15 @@ package pilosa
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"crypto/sha1"
|
||||
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
"sort"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/cespare/xxhash"
|
||||
|
||||
"github.com/boltdb/bolt"
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/pilosa/pilosa/internal"
|
||||
|
|
@ -242,7 +244,7 @@ func (s *AttrStore) Blocks() ([]AttrBlock, error) {
|
|||
block := AttrBlock{ID: cur.blockID()}
|
||||
|
||||
// Compute checksum of every key/value in block.
|
||||
h := sha1.New()
|
||||
h := xxhash.New()
|
||||
for k, v := cur.next(); k != nil; k, v = cur.next() {
|
||||
h.Write(k)
|
||||
h.Write(v)
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ import (
|
|||
"bytes"
|
||||
"container/heap"
|
||||
"context"
|
||||
"crypto/sha1"
|
||||
"encoding/binary"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
|
@ -36,6 +35,8 @@ import (
|
|||
"time"
|
||||
"unsafe"
|
||||
|
||||
"github.com/cespare/xxhash"
|
||||
|
||||
"math"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
|
|
@ -1020,7 +1021,7 @@ type TopOptions struct {
|
|||
// Checksum returns a checksum for the entire fragment.
|
||||
// If two fragments have the same checksum then they have the same data.
|
||||
func (f *Fragment) Checksum() []byte {
|
||||
h := sha1.New()
|
||||
h := xxhash.New()
|
||||
for _, block := range f.Blocks() {
|
||||
h.Write(block.Checksum)
|
||||
}
|
||||
|
|
@ -1660,7 +1661,7 @@ type blockHasher struct {
|
|||
func newBlockHasher() blockHasher {
|
||||
return blockHasher{
|
||||
blockID: -1,
|
||||
hash: sha1.New(),
|
||||
hash: xxhash.New(),
|
||||
}
|
||||
}
|
||||
func (h *blockHasher) Reset() {
|
||||
|
|
|
|||
|
|
@ -1075,3 +1075,26 @@ func TestFragment_Snapshot_Run(t *testing.T) {
|
|||
t.Fatalf("unexpected count (reopen): %d", n)
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkFragment_Snapshot(b *testing.B) {
|
||||
if *FragmentPath == "" {
|
||||
b.Skip("no fragment specified")
|
||||
}
|
||||
|
||||
// Open the fragment specified by the path.
|
||||
f := pilosa.NewFragment(*FragmentPath, "i", "f", pilosa.ViewStandard, 0)
|
||||
if err := f.Open(); err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
// Reset timer and execute benchmark.
|
||||
b.ResetTimer()
|
||||
b.ReportAllocs()
|
||||
for i := 0; i < b.N; i++ {
|
||||
err := f.Snapshot()
|
||||
if err != nil {
|
||||
b.Fatalf("unexpected count (reopen): %s", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue