I have ~10 millions domain objects which has to stay for all application lifetime in memory but can be added or removed any time one by one. Main storage is HashMap<Long, MyDO>
My processing can be done in basic foreach loops but i can optimize some of operations by creating indexes via mapping some object fields like HashMap<String, ArrayList<MyDO>>
which will reduce iteration count for 30-100x but processing more like 2-5x in total
So question is how much slower will be GC for ~10 millions long living objects if i have not one map i store them but 5 maps and thus creating like 5x times references to same objects?
UPD In short: Is it feasable to use generic java collections with boxed keys for indexes in case there are ~10M object with ~1K objects added/removed per second?