On Monday, January 12, 2015 at 8:36:28 AM UTC-5, Andras Niedermayer wrote:
>
> It's still not entirely satisfactory that sorting arrays of tuples is so
> much slower in Julia than in Python,
>
(Note that for sorting an untyped array of tuples, Julia may never have
much if any advantage over Python. Python is already using C code for the
sort implementation and C code to unbox the type and call the comparison
operation. But I agree that for typed arrays of tuples Julia could, in
principle, be faster, especially if you specify similar sort-stability
requirements in both languages.)
> @StefanKarpinski Stable vs unstable sort explains the performance
> difference between `type Pair` and `type Pair <: Number`, but it would
> suggest the opposite of what one sees for sorting `Vector{(Any,Any)}`
> (faster) vs `Vector{(Float64,Int64)}` (slower)
>>
>>
I agree that adding type information should not slow things down. I've
filed an issue https://github.com/JuliaLang/julia/issues/9741