go-io/bench_test.go
Snider ea2343892c feat: standalone io.Medium abstraction
Universal I/O interface extracted from core/go.
Backend-agnostic file operations — local, S3, SQLite, DataNode, Sigil.

- io.Medium: Read/Write/Delete/List/Stat/Rename
- local: filesystem backend
- s3: AWS S3 backend
- sqlite: SQLite-backed virtual filesystem
- datanode: Borg DataNode in-memory fs (snapshot/restore)
- node: composite medium with routing
- sigil: content-addressed storage with crypto hashes

Depends on core/go-log for E() errors, zero core/go dependency.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-06 09:31:28 +00:00

34 lines
638 B
Go

package io
import (
"testing"
)
func BenchmarkMockMedium_Write(b *testing.B) {
m := NewMockMedium()
b.ResetTimer()
for i := 0; i < b.N; i++ {
_ = m.Write("test.txt", "some content")
}
}
func BenchmarkMockMedium_Read(b *testing.B) {
m := NewMockMedium()
_ = m.Write("test.txt", "some content")
b.ResetTimer()
for i := 0; i < b.N; i++ {
_, _ = m.Read("test.txt")
}
}
func BenchmarkMockMedium_List(b *testing.B) {
m := NewMockMedium()
_ = m.EnsureDir("dir")
for i := 0; i < 100; i++ {
_ = m.Write("dir/file"+string(rune(i))+".txt", "content")
}
b.ResetTimer()
for i := 0; i < b.N; i++ {
_, _ = m.List("dir")
}
}