openlvc / disco

Java library for Distributed Interactive Simulation
11 stars 3 forks source link

Add support for Pull Parsing #1

Open timpokorny opened 8 years ago

timpokorny commented 8 years ago

Story

{As a} sim developer with a penchant for speed, {I want} lazy pull parsing support, {So that I can} only take a packet-parsing performance hit for the bits that I actually care about

Context

As part of updates for Cost Counter I have been looking at different optimizations that can be done to the DIS parsing to speed things up. For the most part, spreading the load over multiple threads has worked fine, but there is scope for further speedup. As we are only pulling out a small amount of data for CC, one idea is to implement "pull parsing".

Concept is that rather than deserializing on reception, we just wrap the incoming byte[] and continue with processing. Later on, when someone calls a method for a particular field, we lazy-load it. Take the hit the first time someone makes the call so that we're only working on the bits and pieces that we know the application cares about. Lazy loading would ensure there is no penalty for the second call.

Would have to augment with a method to fully deserialize a packet so that it is easy to do if the need arises. Could also set the lazy-loading mode as a configuration option.

Acceptance Criteria

Once complete, the system shall: