Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
We read the L2 table from storage for reading every cluster. This duplicates the number of I/Os. Now we read every L2 table exactly once and cache it. With the default cluster size (64 KiB), images up to 8 GiB will use 1 MiB for the L2 tables cache. With this change reading entire image is 35.4 times faster for qcow2 image, and 1.6 times faster for compressed qcow2 image. Testing with limactl create shows similar results. Before: % go test -bench Read ... BenchmarkRead/qcow2-12 1 3958425000 ns/op BenchmarkRead/compressed_qcow2-12 1 10840170042 ns/op % limactl create --tty=false --plain ... 3.50 GiB / 3.50 GiB [-------------------------------------] 100.00% 212.28 MiB/s After: % go test -bench Read ... BenchmarkRead/qcow2-12 10 111570342 ns/op BenchmarkRead/compressed_qcow2-12 1 6977782041 ns/op % time limactl create --tty=false --plain ... 3.50 GiB / 3.50 GiB [-------------------------------------] 100.00% 324.13 MiB/s Signed-off-by: Nir Soffer <nsoffer@redhat.com>
- Loading branch information