Fork me on GitHub
#specter
<
2021-04-07
>
h0bbit03:04:03

@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.

h0bbit03:04:24

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!

nathanmarz20:04:07

@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

nathanmarz20:04:15

for top-level transforms there's vtransform to avoid that

nathanmarz20:04:29

would be pretty easy to make a vtransformed to accomplish the same thing for your use case