Skip to content

vitaliyazvinski/js-array-sort-benchmarking

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JS-Array-Sort-Benchmarking

The idea is to practically find out what sorting algorithm is used by JavaScript's built-in Array.prototype.sort() method by comparing its performance with other sorting algorithms on various of input. The following sorting algorithms are implemented and used for benchmarking at the moment:

  1. Insertion Sort
  2. Quick sort
  3. Quick sort with random pivot
  4. Merge sort
  5. Counting sort (since array elements are integers)

How to run

npm run test

Results

Based on the results on random and descending input, it seems that JavaScript's built-in Array.prototype.sort() method might be using Quick sort with additional optimizations on reverse sorted input

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published