systeminit / si

The System Initiative software
https://systeminit.com
Apache License 2.0
955 stars 67 forks source link

Update LayerDb to lazily deserialize values from cache update messages #4574

Closed jhelwig closed 4 days ago

jhelwig commented 1 week ago

Rather than deserializing all values from cache update messages immediately upon receipt, the MemoryCache is now able to store both the deserialized values, and the raw, serialized bytes. If an entry that is currently storing the raw, serialized bytes is retrieved, it will deserialize it at that time, and replace the entry with the deserialized version to prevent having to deserialize it again on next retrieval.

Since we are unlikely to need to retrieve every object we receive cache update messages for, this should significantly reduce the overall amount of time spent processing incoming cache updates, with a hit to the time it takes for the first retrieval of an object we received through a cache update (with no change in subsequent retrieval times).