This commit is contained in:
parent
df92f55df6
commit
154893d9f7
19 changed files with 410 additions and 11 deletions
42
src/fs/bench_test.go
Normal file
42
src/fs/bench_test.go
Normal file
|
@ -0,0 +1,42 @@
|
|||
package fs_test
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"git.urbach.dev/cli/q/src/fs"
|
||||
"git.urbach.dev/go/assert"
|
||||
)
|
||||
|
||||
func BenchmarkReadDir(b *testing.B) {
|
||||
for b.Loop() {
|
||||
files, err := os.ReadDir(".")
|
||||
assert.Nil(b, err)
|
||||
|
||||
for _, file := range files {
|
||||
func(string) {}(file.Name())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkReaddirnames(b *testing.B) {
|
||||
for b.Loop() {
|
||||
f, err := os.Open(".")
|
||||
assert.Nil(b, err)
|
||||
files, err := f.Readdirnames(0)
|
||||
assert.Nil(b, err)
|
||||
|
||||
for _, file := range files {
|
||||
func(string) {}(file)
|
||||
}
|
||||
|
||||
f.Close()
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkWalk(b *testing.B) {
|
||||
for b.Loop() {
|
||||
err := fs.Walk(".", func(string) {})
|
||||
assert.Nil(b, err)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue