TasMovie - TasStateManager - pre-allocate the SortedDictionary size based on state size and memory usage capacity. Fixes the problem of performance grinding to a halt as the movie frame count increases
This commit is contained in:
parent
63b533f15c
commit
3aec45448c
|
@ -21,6 +21,21 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
_movie = movie;
|
||||
Settings = new ManagerSettings();
|
||||
|
||||
var cap = Settings.Cap;
|
||||
|
||||
int limit = 0;
|
||||
if (Global.Emulator != null)
|
||||
{
|
||||
var stateSize = Global.Emulator.SaveStateBinary().Length;
|
||||
|
||||
if (stateSize > 0)
|
||||
{
|
||||
limit = cap / stateSize;
|
||||
}
|
||||
}
|
||||
|
||||
States = new SortedList<int, byte[]>(limit);
|
||||
}
|
||||
|
||||
public ManagerSettings Settings { get; set; }
|
||||
|
|
Loading…
Reference in New Issue