Replace qsort by mergesort, which is more reliable performance-wise. From: Ian Lynagh <igloo@earth.li>