Sometimes it helps to change the structure of the data you are using
to fit the job and simplify matters. In this case it appears that you
are trying to represent a relation. However the tuples are being
represented in a non-associative structure (a list). If you represent
the relation using an
Part of the difference (under 1.2) is due to the (substantial)
overhead of accessing the buffer-size var on every iteration.
I ran a quick check and using David's version of the code result
averaged 17.2ms. Just changing buffer-size to a local with using (let
[buffer-size (int 192)]...) the
My take is almost identical but I used the same length arguments for
the collections which means that the difference in the if branch are
easier to spot, at the cost of more cryptic argument names. This
version will not blow the stack, and its easy to wrap in lazy-seq.
(defn nil-coalesce [s1 s2]