mirror of
https://github.com/schollz/croc.git
synced 2024-11-28 01:16:10 +03:00
update utils benchmark
This commit is contained in:
parent
3e56d4cdb9
commit
9231b1a661
@ -10,11 +10,14 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/schollz/croc/v8/src/models"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
var bigFileSize = 75000000
|
||||
|
||||
func bigFile() {
|
||||
ioutil.WriteFile("bigfile.test", bytes.Repeat([]byte("z"), 75000000), 0666)
|
||||
ioutil.WriteFile("bigfile.test", bytes.Repeat([]byte("z"), bigFileSize), 0666)
|
||||
}
|
||||
|
||||
func BenchmarkMD5(b *testing.B) {
|
||||
@ -47,6 +50,14 @@ func BenchmarkSha256(b *testing.B) {
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkMissingChunks(b *testing.B) {
|
||||
bigFile()
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
MissingChunks("bigfile.test", int64(bigFileSize), models.TCP_BUFFER_SIZE/2)
|
||||
}
|
||||
}
|
||||
|
||||
func TestExists(t *testing.T) {
|
||||
bigFile()
|
||||
defer os.Remove("bigfile.test")
|
||||
|
Loading…
Reference in New Issue
Block a user