You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
EventCommands are pervasive and take up a good portion of total memory usage. Event commands have a dynamic list of parameters but most of them use few (< 10?) parameters. Many commands have a fixed size number of parameters. small_vector<T,N> is perfectly suited for this situation.
Survery a bunch of games to find a good value for N.
Write or import a small_vector implementation into liblcf.
Change EventCommand::parameters and others if it makes sense.
Using small_vector will greatly improve cache locality when interpreting event streams. This should result in higher performance in Player.
It'll also result in dramatically fewer memory allocations, resulting in measurably higher lcf reading performance. Less allocations also means less memory overhead, which should slightly reduce memory usage of liblcf.
Small vector has the same interface as vector, so it can be an easy drop-in replacement.
iirc the only "long" commands are Show/Move Picture, Inn (item list) and Move event (the whole move route), we could parse through all games in our test set and calculate statistics about the parameter length to get the optimal result.
EventCommands are pervasive and take up a good portion of total memory usage. Event commands have a dynamic list of parameters but most of them use few (< 10?) parameters. Many commands have a fixed size number of parameters.
small_vector<T,N>
is perfectly suited for this situation.EventCommand::parameters
and others if it makes sense.Using small_vector will greatly improve cache locality when interpreting event streams. This should result in higher performance in Player.
It'll also result in dramatically fewer memory allocations, resulting in measurably higher lcf reading performance. Less allocations also means less memory overhead, which should slightly reduce memory usage of liblcf.
Small vector has the same interface as vector, so it can be an easy drop-in replacement.
Some example implementations are here:
The text was updated successfully, but these errors were encountered: