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
Locks are used to make RTPacket.cs thread safe. In order to have one thread executing the SetData method while another thread could poll the parsed data through different Get methods. The design dependnds on the .ToList method for making shallow copies of the shared data. This is working right now because most components simply allocate new arrays for every packet. This creates garbage which is no good for realtime applications.
We could conserve allocations by reusing lists instead of depending on fresh arrays. We would also need to make deep copies of the structures instead of using .ToList in the Get methods.
The text was updated successfully, but these errors were encountered:
qjgn
changed the title
Flawed locks
Making less allocations
Sep 15, 2020
Locks are used to make RTPacket.cs thread safe. In order to have one thread executing the SetData method while another thread could poll the parsed data through different Get methods. The design dependnds on the .ToList method for making shallow copies of the shared data. This is working right now because most components simply allocate new arrays for every packet. This creates garbage which is no good for realtime applications.
We could conserve allocations by reusing lists instead of depending on fresh arrays. We would also need to make deep copies of the structures instead of using .ToList in the Get methods.
The text was updated successfully, but these errors were encountered: