By using the memory snapshots with real examples we found some bottlenecks. Therefor I have implemented some optimizations.
We found that the flatview creation is quite expensive (around 1/4 of all runtime including emulation) when you have a lot of memory regions. By permanently creating new regions with CoW we have a lot of regions and rebuild for each cow the flatview again. I have added a update function does only change affected ranges.
Also we found that the find_ram_offset_last optimization doesn't work after a restore. To fix this the context now includes also the ramblock_freed bool.
This also includes two smaller optimizations: only clear the affected tlb on memory_cow and save the last ramblock of the ram_list
It's currently only a draft, because we need to do a few more tests to see if the optimization works as expected.
By using the memory snapshots with real examples we found some bottlenecks. Therefor I have implemented some optimizations.
We found that the flatview creation is quite expensive (around 1/4 of all runtime including emulation) when you have a lot of memory regions. By permanently creating new regions with CoW we have a lot of regions and rebuild for each cow the flatview again. I have added a update function does only change affected ranges.
Also we found that the
find_ram_offset_last
optimization doesn't work after a restore. To fix this the context now includes also theramblock_freed
bool.This also includes two smaller optimizations: only clear the affected tlb on memory_cow and save the last
ramblock
of theram_list
It's currently only a draft, because we need to do a few more tests to see if the optimization works as expected.