• Daniel Martí's avatar
    add the first read-only benchmarks · 311809b0
    Daniel Martí authored
    BenchmarkReadBlocks uses carv2.OpenReader with its Roots and Next method.
    From six runs on a laptop with a i5-8350U and benchstat:
    
    	name          time/op
    	ReadBlocks-8    633µs ± 2%
    
    	name          speed
    	ReadBlocks-8  824MB/s ± 2%
    
    	name          alloc/op
    	ReadBlocks-8   1.32MB ± 0%
    
    	name          allocs/op
    	ReadBlocks-8    13.5k ± 0%
    
    OpenReadOnlyV1 uses blockstore.OpenReadOnly with its Get method.
    The method is used on all blocks in a shuffled order,
    to ensure that the index is working as intended.
    The input file lacks an index, so we also generate that.
    
    	name              time/op
    	OpenReadOnlyV1-8    899µs ± 1%
    
    	name              speed
    	OpenReadOnlyV1-8  534MB/s ± 1%
    
    	name              alloc/op
    	OpenReadOnlyV1-8   1.52MB ± 0%
    
    	name              allocs/op
    	OpenReadOnlyV1-8    27.2k ± 0%
    
    Both benchmarks use the "sample" v1/v2 CAR files, which weigh about half
    a megabyte. It seems like a good size; a significantly larger CAR file
    would make each benchmark iteration take tens or hundreds of
    milliseconds, making it much slower to obtain many benchmark results,
    since we want at least thousands of iterations to avoid noise.
    311809b0
bench_test.go 807 Bytes