But also, it's a part that may be optimized later: right now it works under an assumption that simulated events are both rare (not happen often) and not numerous. If some game will spam simulated events inside a single frame, we'll end up with big slices. Big slices are an issue for our linear search algorithm.
Maybe we need to do a sorting inside System.Update() method of all current events and do a binary search. For the small number of events, like <10 it won't make much of a difference, but for the 1000+ events it will work much better. But maybe there is even a better solution.
Having tests and benchmarks would make optimizations/refactoring easier there.
This is the easiest part of the library to test.
But also, it's a part that may be optimized later: right now it works under an assumption that simulated events are both rare (not happen often) and not numerous. If some game will spam simulated events inside a single frame, we'll end up with big slices. Big slices are an issue for our linear search algorithm.
Maybe we need to do a sorting inside
System.Update()
method of all current events and do a binary search. For the small number of events, like <10 it won't make much of a difference, but for the 1000+ events it will work much better. But maybe there is even a better solution.Having tests and benchmarks would make optimizations/refactoring easier there.