WolfCorps / TacControl

Other
15 stars 4 forks source link

Websocket/state performance improvement #32

Open dedmen opened 2 years ago

dedmen commented 2 years ago

https://github.com/WolfCorps/TacControl/blob/master/src/ArmaExt/src/Networking/websocket.cpp#L81 don't create a new one and clean up the old, if old state has only one reference to it, just move assign. 28% of worker thread time is spent creating new json, 36% is spent cleaning up the old one.

https://github.com/WolfCorps/TacControl/blob/master/src/ArmaExt/src/Networking/websocket.cpp#L88 diff with newState makes no sense, newState has already been moved away and should by now be empty?!

Improvement here: https://github.com/WolfCorps/TacControl/blob/master/src/ArmaExt/src/Modules/ModuleMarker.cpp#L337

This serialize doesn't support existing content, it always overwrites. https://github.com/WolfCorps/TacControl/blob/master/src/ArmaExt/src/Networking/Serialize.hpp#L144

If we could write into the existing json object that we already have, instead of always replacing the whole object, we could save quite a bit.