Improving performance while sorting a JavaScript Object
Disclaimer: I don't know anything about javascript  

If you have a construct like  

if (condition){
   return someValue;
} else { 
   return someOtherValue;
}


the else can be omited, because if the first condition is true the else is never reached.  

So your code could be refactored to  

filtered.sort(function (a, b) {
  if (!b.sortdist) { return -1; }
  if (!a.sortdist || a.sortdist &gt; b.sortdist) { return 1; }
  return -1;
});  


which doesn't improve the performance, but I don't see anything to make your code faster.