You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • This is great - thanks! I'll stick these in the benchmark suite - they should be really useful to help work on function call/array access overhead.

    By the way, if you want a little more speed, you can minify the function:

    Array.prototype.nqsort=function(d){var f,c=0,a,b;void 0===d&&(d=parseInt(Math.floor(this.lengt­h/5),10));var g=new Uint16Array(d),e=new Uint16Array(d);g[0]=0;for(e[0]=this.leng­th;0<=c;)if(a=g[c],b=e[c]-1,a<b){f=this[­a];if(c===d-1)return!1;for(;a<b;){for(;t­his[b]>=f&&a<b;)b--;for(a<b&&(this[a++]=­this[b]);this[a]<=f&&a<b;)a++;a<b&&(this­[b--]=this[a])}this[a]=f;g[c+1]=a+1;e[c+­1]=e[c];e[c++]=a}else c--;return!0};
    
About

Avatar for Gordon @Gordon started