Chronicle-Map
Chronicle-Map copied to clipboard
Persistent map file using custom marshaller is significantly larger than a using built-in one
I created two maps. One is ChronicleMap<IntValue, Boolean> and another one is ChronicleMap<IntValue, CustomData>. There's also a custom marshaller for CustomData that writes 0 bytes effectively creating a set from a map. That is confirmed in preMapConstruction() when averageValueSize is calculated and it is 0.0. After that, I initialize both maps with 2M, 20M, 200M, and 2B entries on MacOS 10.14. Here's what file sizes look like:
| . | 2M | 20M | 200M | 2B |
|---|---|---|---|---|
| Boolean | 35.7MB | 325.1MB | 4.05GB | 36.08GB |
| CustomData | 43.3MB | 397.9MB | 4.76GB | 43.18GB |
So even when the custom object and its marshaller supposed to take less space, their map file is 20% larger.
Another experiment was with <IntValue, Integer> and <IntValue, Byte> maps. There's no built-in marshaller for Byte, so I created one based on IntegerMarshaller just swapping Integer with Byte and setting the size to 1L instead of 4L.
| . | 2M |
|---|---|
| Integer | 41.9MB |
| Byte | 45.6MB |
That just does not make sense.
@edudar is this still a relevant question for you?
I moved away from where I needed ChronicleMap about 2 years ago, so it's not relevant to me personally, but it might be in general.