Thanks @Henrique_Becker and @tim.holy, that is helpful to know. That is indeed more complex of an issue than I was expecting. I’m glad we figured it out though.
For posterity, I see the speeds go back to normal with the following modification:
function tree_mapreduce(
args...,
+ result_type::Type{RT}=Nothing,
;
preserve_sharing::Bool=false,
- result_type::Type{RT}=Nothing,
)
if preserve_sharing && result_type != Nothing
return _tree_mapreduce(args..., IdDict{Node,RT}())
else
return _tree_mapreduce(args...)
end
end
which gives me the same speeds as if the branching code was commented out.