Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace std::ptr::copy() with copy_slice()
Replace std::ptr::copy() with copy_slice(). With this change applied, most accesses to guest memory are wrapped by copy_slice() to avoid mixing read/write_volatile() and memcpy(). The file related interfaces, read_from()/read_exact_from()/write_to()/write_all_to(), may still use normal memory operations. The change causes more than 50% performance drop of copy_to_volatile_slice() when copying 10K data buffer. The performance drop is caused by non-optimal implemantation of copy_slice(), which should be tracked as a dedicate issue. Benchmarking VolatileSlice::copy_to_volatile_slice: Collecting 200 samples in estimated 10.000 s VolatileSlice::copy_to_volatile_slice time: [684.24 ns 687.08 ns 691.81 ns] change: [+134.93% +136.04% +137.32%] (p = 0.00 < 0.05) Performance has regressed. Found 11 outliers among 200 measurements (5.50%) 1 (0.50%) low mild 4 (2.00%) high mild 6 (3.00%) high severe Fixes: rust-vmm#111 Signed-off-by: Liu Jiang <[email protected]>
- Loading branch information