Problem statement
Eduction is useful part of the transducer ecosystem, which has a benefit/aim of improved performance. However, the function eduction only has a single varargs arity, which adds multiple function calls and and seq traversal allocations.
As seen in this PR to clj-kondo, manually passing in an xform directly can improve both overall performance and lower allocations.
Proposal
Adding arities to eduction can sidestep those allocations and seq traversals, improving baseline performance of all eduction invocations.
(defn eduction2
{:arglists '([xform* coll])
:added "1.7"}
([coll] (->Eduction identity coll))
([f1 coll] (->Eduction f1 coll))
([f1 f2 coll] (->Eduction (comp f1 f2) coll))
([f1 f2 f3 coll] (->Eduction (comp f1 f2 f3) coll))
([f1 f2 f3 f4 & args]
(->Eduction (apply comp f1 f2 f3 f4 (butlast args)) (last args))))