"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
build: modernize benchmark usage
Nick Craig-Wood04d49bf0ea20
diff --git a/backend/onedrive/quickxorhash/quickxorhash_test.go b/backend/onedrive/quickxorhash/quickxorhash_test.goindex a239ed02f..879580c4f 100644--- a/backend/onedrive/quickxorhash/quickxorhash_test.go+++ b/backend/onedrive/quickxorhash/quickxorhash_test.go@@ -172,8 +172,8 @@ func BenchmarkQuickXorHash(b *testing.B) {require.NoError(b, err)require.Equal(b, len(buf), n)h := New()- b.ResetTimer()- for i := 0; i < b.N; i++ {++ for b.Loop() {h.Reset()h.Write(buf)h.Sum(nil)diff --git a/fs/dirtree/dirtree_test.go b/fs/dirtree/dirtree_test.goindex 45cd9a3aa..8a88fc18d 100644--- a/fs/dirtree/dirtree_test.go+++ b/fs/dirtree/dirtree_test.go@@ -213,7 +213,7 @@ func BenchmarkCheckParents(b *testing.B) {dt.Add(o)}b.StartTimer()- for n := 0; n < b.N; n++ {+ for b.Loop() {dt.CheckParents("")}})diff --git a/lib/mmap/mmap_test.go b/lib/mmap/mmap_test.goindex 0fb0b797f..318a8a2ec 100644--- a/lib/mmap/mmap_test.go+++ b/lib/mmap/mmap_test.go@@ -31,7 +31,7 @@ func BenchmarkAllocFree(b *testing.B) {for _, dirty := range []bool{false, true} {for size := 4096; size <= 32*1024*1024; size *= 2 {b.Run(fmt.Sprintf("%dk,dirty=%v", size>>10, dirty), func(b *testing.B) {- for i := 0; i < b.N; i++ {+ for b.Loop() {mem := MustAlloc(size)if dirty {mem[0] ^= 0xFF@@ -62,7 +62,7 @@ func BenchmarkAllocFreeWithLotsOfAllocations(b *testing.B) {for preAllocs := 1; preAllocs <= maxAllocs; preAllocs *= 2 {allocs := alloc(preAllocs)b.Run(fmt.Sprintf("%d", preAllocs), func(b *testing.B) {- for i := 0; i < b.N; i++ {+ for b.Loop() {mem := MustAlloc(size)mem[0] ^= 0xFFMustFree(mem)@@ -90,7 +90,7 @@ func BenchmarkAllocFreeForLotsOfAllocations(b *testing.B) {}for preAllocs := 1; preAllocs <= maxAllocs; preAllocs *= 2 {b.Run(fmt.Sprintf("%d", preAllocs), func(b *testing.B) {- for i := 0; i < b.N; i++ {+ for b.Loop() {allocs := alloc(preAllocs)free(allocs)}