mirror of
https://github.com/restic/restic.git
synced 2025-08-23 09:47:42 +00:00
add changelog, benchmark, memory calculation
This commit is contained in:
@@ -398,18 +398,16 @@ func createRandomIndex(rng *rand.Rand) (idx *repository.Index, lookupID restic.I
|
||||
// create index with 200k pack files
|
||||
for i := 0; i < 200000; i++ {
|
||||
packID := NewRandomTestID(rng)
|
||||
var blobs []restic.Blob
|
||||
offset := 0
|
||||
for offset < maxPackSize {
|
||||
size := 2000 + rand.Intn(4*1024*1024)
|
||||
id := NewRandomTestID(rng)
|
||||
idx.Store(restic.PackedBlob{
|
||||
PackID: packID,
|
||||
Blob: restic.Blob{
|
||||
Type: restic.DataBlob,
|
||||
ID: id,
|
||||
Length: uint(size),
|
||||
Offset: uint(offset),
|
||||
},
|
||||
blobs = append(blobs, restic.Blob{
|
||||
Type: restic.DataBlob,
|
||||
ID: id,
|
||||
Length: uint(size),
|
||||
Offset: uint(offset),
|
||||
})
|
||||
|
||||
offset += size
|
||||
@@ -418,6 +416,7 @@ func createRandomIndex(rng *rand.Rand) (idx *repository.Index, lookupID restic.I
|
||||
lookupID = id
|
||||
}
|
||||
}
|
||||
idx.StorePack(packID, blobs)
|
||||
}
|
||||
|
||||
return idx, lookupID
|
||||
@@ -444,6 +443,13 @@ func BenchmarkIndexHasKnown(b *testing.B) {
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkIndexAlloc(b *testing.B) {
|
||||
b.ReportAllocs()
|
||||
for i := 0; i < b.N; i++ {
|
||||
createRandomIndex(rand.New(rand.NewSource(0)))
|
||||
}
|
||||
}
|
||||
|
||||
func TestIndexHas(t *testing.T) {
|
||||
type testEntry struct {
|
||||
id restic.ID
|
||||
|
Reference in New Issue
Block a user