This gives a 6x speed boost with a large volume on my system. The changes:
Avoid calling collect on the whole Dict, which was very expensive because of all the heap-allocated tuples. Instead just iterate over keys to construct vtD and collect values to construct vtAry.
Avoid allocating temporary arrays, replacing them with tuples where that simplifies the code.
Remove expensive vId inner function. Unfortunately this results in some ugliness, but I think the performance gain is worth it.
Coverage decreased (-0.15%) when pulling dd8142c5343ac0efdba79032f533963efd49ca37 on simonster:perf into 8b2e55545117225023f164ac11a2fc9f0c3a148a on twadleigh:master.
This gives a 6x speed boost with a large volume on my system. The changes:
collect
on the whole Dict, which was very expensive because of all the heap-allocated tuples. Instead just iterate over keys to constructvtD
and collect values to constructvtAry
.vId
inner function. Unfortunately this results in some ugliness, but I think the performance gain is worth it.