@nathanmarz: thanks, I rewrote it as follows:
(s/select [s/ALL :systems s/ALL :containers s/ALL
(s/transformed [(s/collect-one :name) :dependencies s/ALL]
(fn [c d]
{:container c
:dependency (:name d)
:transports (:transport d)
:entities (:data_entity d '())}))
:dependencies s/ALL]
yaml-data)
This works correctly, but is still slower on criterium benchmarks (129.3 us for ->>
version, 129.9 for same code with transduce
instead of ->>
, 193.7 us for this form above, 307.7 us for my previous select + transform + select
version.I’ll continue to play some more with specter in this project, thank you for the work you’ve put into it and for releasing it to all of us!
@h0bbit i would guess value collection is the source of the slowdown, as it causes the transform fn to be run with apply
rather than a direct invoke
for top-level transforms there's vtransform
to avoid that
would be pretty easy to make a vtransformed
to accomplish the same thing for your use case