scozv / algo-js

[obsoleted] has been moved to project Tango:
https://github.com/scozv/tango
GNU General Public License v3.0
2 stars 1 forks source link

quick sort for an array with length 359032 from scc data is slow #13

Closed scozv closed 10 years ago

scozv commented 10 years ago

From Algo.js of Google Code on August 02, 2013 17:41:55

What steps will reproduce the problem?

  1. debug stop before sort connect info of scc using 875714 vertex graph data
  2. run heap sort, or merge sort is faster than quick sort by feeling

Please use labels and text to provide additional information. inspect into it, see whether clone array is slow or not.

Original issue: http://code.google.com/p/algo-js/issues/detail?id=13

scozv commented 10 years ago

From Algo.js of Google Code on August 05, 2013 00:59:23

here is running time of sorting connect info:

Code Time (ms)
var T = Math.__timer__;
T(function(){Sorting.quickSort(connect, function(x, y){return y-x;})}); 6209
T(function(){Sorting.quickSort(connect)}); 326
T(function(){Sorting.mergeSort(connect, function(x, y){return y-x;})}); 405
T(function(){Sorting.mergeSort(connect)}); 509
T(function(){Sorting.mergeSortBU(connect, function(x, y){return y-x;})}); 403
T(function(){Sorting.mergeSortBU(connect);}); 427
T(function(){Sorting.heapSort(connect, {order:'ASC'})}); 292
T(function(){Sorting.heapSort(connect, {order:'DESC'})}); 207

Status: Started

scozv commented 10 years ago

From Algo.js of Google Code on September 27, 2013 02:38:29

fixed in revision 6bf2dfd1d73e