• Han-Wen Nienhuys's avatar
    benchmark: introduce benchmark for loopback reads · ab014071
    Han-Wen Nienhuys authored
    Loopback (file backed by some other file on disk) is an important
    use-case, and FUSE features such as passthrough and splicing aim to
    reduce overhead.
    
    Example: 
    
        Splice disabled:
    
        $ go test -bench FD -test.cpu=1,2
        goos: linux
        goarch: amd64
        pkg: github.com/hanwen/go-fuse/v2/benchmark
        cpu: Intel(R) Core(TM) i5-8350U CPU @ 1.70GHz
        BenchmarkGoFuseFDRead     	    1929	    597942 ns/op	3507.28 MB/s	    4290 B/op	     129 allocs/op
        BenchmarkGoFuseFDRead-2   	    2497	    421856 ns/op	4971.26 MB/s	   62500 B/op	     177 allocs/op
        PASS
        ok  	github.com/hanwen/go-fuse/v2/benchmark	3.510s
    
        Splice enabled:
    
        $ go test -bench FD -test.cpu=1,2
        goos: linux
        goarch: amd64
        pkg: github.com/hanwen/go-fuse/v2/benchmark
        cpu: Intel(R) Core(TM) i5-8350U CPU @ 1.70GHz
        BenchmarkGoFuseFDRead     	    1524	    750249 ns/op	2795.28 MB/s	    4132 B/op	      98 allocs/op
        BenchmarkGoFuseFDRead-2   	    2364	    463522 ns/op	4524.39 MB/s	   11719 B/op	     106 allocs/op
        PASS
    
    in other words, the API complexity that splicing introduced was not
    worth it: it actually slows down things.
    
    Change-Id: I4f7519ab2cc5b0145d0f7f81f55ad20d544e9d87
    ab014071
read_test.go 1.71 KB