Skip to content

Instantly share code, notes, and snippets.

@souenzzo

souenzzo/pathom.clj

Created Jan 10, 2020
Embed
What would you like to do?
pathom vs select-keys
(let [parser (p/parser {::p/plugins [(pc/connect-plugin {::pc/register [(pc/constantly-resolver ::f 42)]})]})
env {::p/reader [p/map-reader
pc/reader2]}
query [::f]
m {::f 42}]
(doseq [[k v] {:map-select #(p/map-select m query)
:parser #(parser env query)
:select-keys #(select-keys env query)}]
(prn k)
(dotimes [i 5]
(time
(dotimes [i 1e4]
(v))))))
:map-select
"Elapsed time: 425.844485 msecs"
"Elapsed time: 380.925666 msecs"
"Elapsed time: 374.067969 msecs"
"Elapsed time: 372.911105 msecs"
"Elapsed time: 379.872111 msecs"
:parser
"Elapsed time: 809.992517 msecs"
"Elapsed time: 798.581048 msecs"
"Elapsed time: 798.001235 msecs"
"Elapsed time: 796.094161 msecs"
"Elapsed time: 802.127007 msecs"
:select-keys
"Elapsed time: 2.45467 msecs"
"Elapsed time: 2.062788 msecs"
"Elapsed time: 2.008124 msecs"
"Elapsed time: 1.997037 msecs"
"Elapsed time: 1.669299 msecs"
=> nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment