In #450 the cache for the first added read is a HashMap, which is initialize with the empty constructor (no initial capacity and default load factor). We should evaluate if performance could be improved by:
Using a different map implementation. In #450, the implementation only uses put and remove methods (and keySet only for formatting, so no performance issue there). For each proper-pair added, remove is called and if not present, put is called. An implementation with efficient put/remove methods will be ideal.
Sensible initial capacity. Because every proper-read added is going to be put in the map, this could improve performance a lot. The problem with the initial capacity is that any guess is inaccurate, because it depends on the total coverage and window size. Maybe we can initialize with the length of the window as a rough estimate (or multiplying by some factor).
Even if there is no PairEndReadStatFunction included, we check if the mate is on the window and if so the ProperReadHash is constructed and queried on the map. This could have some performance issues for runs where no pair-end statistic is requested. This is easier to improve by adding a check to the size of the Map<PairEndReadStatFunction, Object>, which can be initialized to an emptyMap in case that the list is empty.
In #450 the cache for the first added read is a
HashMap
, which is initialize with the empty constructor (no initial capacity and default load factor). We should evaluate if performance could be improved by:keySet
only for formatting, so no performance issue there). For each proper-pair added, remove is called and if not present, put is called. An implementation with efficient put/remove methods will be ideal.PairEndReadStatFunction
included, we check if the mate is on the window and if so theProperReadHash
is constructed and queried on the map. This could have some performance issues for runs where no pair-end statistic is requested. This is easier to improve by adding a check to the size of theMap<PairEndReadStatFunction, Object>
, which can be initialized to anemptyMap
in case that the list is empty.