help wantedperformancespeculative
Description
Was at first surprised that unique doesn't filter custom types even if they evaluate to equal by == but the helpdoc does say they should be equivalent and \equiv evaluates to is, however have noticed several times on both 0.3 and 0.4 that functions filling up an array with objects created through permutations and then return unique(result) will produce an array of variable length from a deterministic algorithm. The most recent encounter was with findpows (in this commit) before unique was replaced with uniquefilter. Have not had the handpower to unwrap a case into a neat isolated example and would not have opened this if not for the following unearthed feature of uniquefilter{T}(a::Array{T})=pushallunique!(T[],a):
julia> r=rand(Int,1000000)%3;
julia> @time for i in 1:1000;unique(r);end
elapsed time: 23.492532326 seconds (560000 bytes allocated)
julia> @time for i in 1:1000;Equations.uniquefilter(r);end
elapsed time: 11.805153784 seconds (160000 bytes allocated)