qualisys / qualisys_dotnet_sdk

C# (.NET) implementation of the real-time protocol for Qualisys Track Manager
MIT License
8 stars 5 forks source link

Making less allocations #14

Open qjgn opened 4 years ago

qjgn commented 4 years ago

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.

qjgn commented 3 years ago

21 Is allowing the user to re-use lists when fetching component data.