Use quicksort instead of native sort function - surprise! it's faster
Code\n\nfunction sortBy(arr: any[], fn: Function, left = 0, right = arr.length - 1): any[] {\n    if (left >= right) {\n        return;\n    }\n\n    const pivo
# Code\n```\nfunction sortBy(arr: any[], fn: Function, left = 0, right = arr.length - 1): any[] {\n    if (left >= right) {\n        return;\n    }\n\n    const pivotIndex = partition(arr, fn, left, right);\n\n    sortBy(arr, fn, left, pivotIndex - 1);\n    sortBy(arr, fn, pivotIndex + 1, right);\n\n    return arr;\n};\n\nfunction partition(arr: any[], fn: Function, left: number, right: number): number {\n  const pivot = arr[right];\n  let i = left - 1;\n\n  for (var j = left; j < right; j++) {\n    if (fn(arr[j]) <= fn(pivot)) {\n      i++;\n      swap(arr, i, j);\n    }\n  }\n\n  swap(arr, i + 1, right);\n  return i + 1;\n}\n\nfunction swap(arr: any[], i: number, j: number) {\n  const temp = arr[i];\n  arr[i] = arr[j];\n  arr[j] = temp;\n}\n\n```
['TypeScript']