Sort Algorithms in Julia
Your mergesort has a serious issue. If you run

size=100000
x=rand(1:(2^62),size)
@time(mergesort!(x))


you will find that your algorithm is allocating ram 2.34 million times, and is allocating 37.4 GB The problem comes from this block:

while length(left) != 0 &amp;&amp; length(right) != 0
  if left[1] &lt;= right[1]
    result[k] = left[1]
    left      = left[2:end]
  else
    result[k] = right[1]
    right = right[2:end]
  end
  k += 1
end


If you instead write,

left_ind = 1
right_ind = 1
r_ind = 1
while left_ind&lt;=length(left) &amp;&amp; right_ind&lt;=length(right)
    if left[left_ind]&lt;right[right_ind]
        result[r_ind]=left[left_ind]
        left_ind += 1
    else
        result[r_ind]=right[right_ind]
        right_ind += 1
    end
    r_ind += 1
end
if left_ind&lt;=length(left)
    result[r_ind:end] = left[left_ind:end]
elseif right_ind&lt;=length(right)
    result[r_ind:end] = right[right_ind:end]
end
result


This drops the time from 3.7 seconds to .2 seconds, and memory allocation to 57MB