Fork me on GitHub
#pathom
<
2021-10-12
>
kendall.buchanan18:10:09

Does anyone know if there’s a performance trade-off between the following two resolvers, in Pathom3?

kendall.buchanan18:10:13

(pco/defresolver user-ids-by-group-resolver
  [{db :db}
   {group-id :group/id}]
  {::pco/output [:group.user/ids]}
  {:group.user/ids (expensive-db-query group-id)})

kendall.buchanan18:10:25

(pco/defresolver user-ids-by-group-resolver
  [{db :db}
   {group-id :group/id}]
  {:group.user/ids (expensive-db-query group-id)})

kendall.buchanan18:10:08

In the former, ::pco/output can signal the return value of the resolver without invoking expensive-db-query. Or does macro magic make the two queries identical?

souenzzo18:10:16

both identical. You can check with macroexpand or do a simple benchmark

👍 1
wilkerlucio21:10:19

the output will be computed at code read time in this case, so if the result is the same, the runtime is also the same