mirror of
https://github.com/schollz/croc.git
synced 2024-11-24 08:02:33 +03:00
add more benchmarks
This commit is contained in:
parent
94b3dba034
commit
ab5ae5cbb6
@ -94,6 +94,15 @@ func IMOHashFile(fname string) (hash []byte, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
var imofull = imohash.NewCustom(0, 0)
|
||||
|
||||
// IMOHashFileFull returns imohash of full file
|
||||
func IMOHashFileFull(fname string) (hash []byte, err error) {
|
||||
b, err := imofull.SumFile(fname)
|
||||
hash = b[:]
|
||||
return
|
||||
}
|
||||
|
||||
// XXHashFile returns the xxhash of a file
|
||||
func XXHashFile(fname string) (hash256 []byte, err error) {
|
||||
f, err := os.Open(fname)
|
||||
|
@ -35,6 +35,7 @@ func BenchmarkXXHash(b *testing.B) {
|
||||
XXHashFile("bigfile.test")
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkImoHash(b *testing.B) {
|
||||
bigFile()
|
||||
b.ResetTimer()
|
||||
@ -43,6 +44,14 @@ func BenchmarkImoHash(b *testing.B) {
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkImoHashFull(b *testing.B) {
|
||||
bigFile()
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
IMOHashFileFull("bigfile.test")
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkSha256(b *testing.B) {
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
|
Loading…
Reference in New Issue
Block a user