Is java.util.Hashtable more memory efficient than containers.Map / struct?
7 views (last 30 days)
I am saving large amounts of traffic data in a format suitable for real-time data analysis/visualisation. I need quick/constant access to traffic data corresponding to a given day/direction. At the moment, I am structuring my data as follows:
- containers.Map containing one key per direction+date. The value is a struct with fields Speed (single array), Flow (single array), Incidents (array), etc.
The issue is that the files easily exceed 1GB, so I am trying to minimise their footprint.
I did a quick test storing 2 arrays of 100x100 uint8 in different formats and found java.util.Hashtable to be surprisingly small:
- array 20kB
- struct 29kB
- cell 24kB
- map 24kB
- java hashtable 8kB
I am considering to swap my containers.Map and structs with nested java hashTables. Is this a good idea? And how come the size of the file is so small for a java.Hashtable? (I am assuming some kind of compression is happening there)