Affects Version/s: None
Fix Version/s: None
Problem: Currently select-keys uses conj to add entries. If the map is editable, conj! could be used instead to improve select-keys performance.
Additionally keyseq is traversed as a seq but could be traversed via reduce instead, which might be faster.
Approach 1: Use a transient map and conj!, keeping loop/recur
Approach 2: Reimplement select-keys to use reduce instead of loop/recur
Approach 3: Combine approach one and two
|selected key size||loop/recur||transient||reduce||transient + reduce|
|1||243 ns||256 ns||161 ns||188 ns|
|7||1.1 ms||885 ns||454 ns|
From these numbers, approach 3 was chosen.
Note: In order to implement select-keys in terms of reduce, select-keys needed to be moved until after the definition of reduce. This forced a (declare select-keys) since it's used before the definition of reduce