compareTo optimized