I need to reduce the memory footprint of my program, while retaining some speed. I might also switch data structures. The problem: I need to count all integers of a fixed size in bits, let's say 32 bits, from a file.
Right now I am using a concurrent hashmap, but after some time it spikes to 10GB or RAM and since computation basically stops, I think I am just trashing my memory (laptop with 8GB). Another option is to use a concurrent vector.
Also, I am using a pipeline to read the integers, I don't know if this point might be optimized.