Not an answer to your question, but this usage of tuples looks overly complicated. Why not just
if (p1, p2) in seen
return score(p1),1
end
push!(seen, (p1, p2))
It is possible, that Tuple([Tuple(p1), Tuple(p2)])
construction creates intermediate arrays.