specter

Latest version: 1.1.3
h0bbit 2021-04-07T03:25:03.003600Z

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

h0bbit 2021-04-07T03:29:24.006Z

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!

nathanmarz 2021-04-07T20:33:07.007100Z

@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

nathanmarz 2021-04-07T20:33:15.007400Z

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

nathanmarz 2021-04-07T20:33:29.007800Z

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