mem: use cheaper hash for backend

This commit is contained in:
Michael Eischer 2022-10-15 23:14:33 +02:00
parent c3400d3c55
commit 28e1c4574b

View file

@ -3,13 +3,13 @@ package mem
import ( import (
"bytes" "bytes"
"context" "context"
"crypto/md5"
"encoding/base64" "encoding/base64"
"hash" "hash"
"io" "io"
"io/ioutil" "io/ioutil"
"sync" "sync"
"github.com/cespare/xxhash/v2"
"github.com/restic/restic/internal/backend" "github.com/restic/restic/internal/backend"
"github.com/restic/restic/internal/backend/sema" "github.com/restic/restic/internal/backend/sema"
"github.com/restic/restic/internal/debug" "github.com/restic/restic/internal/debug"
@ -266,7 +266,7 @@ func (be *MemoryBackend) Location() string {
// Hasher may return a hash function for calculating a content hash for the backend // Hasher may return a hash function for calculating a content hash for the backend
func (be *MemoryBackend) Hasher() hash.Hash { func (be *MemoryBackend) Hasher() hash.Hash {
return md5.New() return xxhash.New()
} }
// HasAtomicReplace returns whether Save() can atomically replace files // HasAtomicReplace returns whether Save() can atomically replace files