OpenHFT / Chronicle-Map

Replicate your Key Value Store across your network, with consistency, persistance and performance.
http://chronicle.software/products/chronicle-map/
Apache License 2.0
2.77k stars 469 forks source link

Inaccurate or unclear example in tutorial documentation #486

Open daveagill opened 1 year ago

daveagill commented 1 year ago

There is some potential misinformation in an example from the tutorial titled "Working with an entry within a context"

The example has this line of code and proceeding comment:

PostalCodeRange range = entry.value().get();
// Access the off-heap memory directly, by calling range
// object getters.
// This is very rewarding, when the value has a lot of fields
// and expensive to copy to heap all of them, when you need to access
// just a few fields.

The comment seems to suggest that invoking getters would only deserialize the relevant part of the object from the off-heap storage.

However from poking around the source it seems to me that entry.value() returns a CompiledMapQueryContext$EntryValueBytesData (which I have confirmed in a pet project) and the get() method deserializes the entire value into a cached object. Really no different from calling getUsing() and passing in your own object.

My belief is the comment is simply incorrect. But looking for confirmation?