question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Sorting Performance

See original GitHub issue

Picking up from #366 what do you recommend for sorting? On my end, at least with the code I wrote, sorting is way slower than the initial rendering. I tried two approaches.

Approach 1: Sorts array then refresh with $.observable(array).refresh(sorted);

Approach 2: Iterate array and move items around as we sort using $.observable(array).move(...)

Not sure if there’s any other way to sort. 🤔

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
BorisMoorecommented, Feb 25, 2017

I plan to provide for async deferred data-linking after V1. See https://github.com/BorisMoore/jsviews/issues/368.

1reaction
BorisMoorecommented, Feb 24, 2017

With the new update I am working on (84) Approach 1 will no longer involve any calls to cleanData, and will simply shuffle the tr’s (and update #index properties etc.).

I just tested it in Chrome with your full data, and I get: 2.17 seconds initial render 1.54 seconds sort

(Sorting on City):

var sorted = model.Entries.slice().sort(function(a, b) {
  return a.f2.value.localeCompare(b.f2.value);
});

Approach 2 will work fine too, but Approach 1 in fact uses .move() internally - so for you Approach 1 is simpler.

If you are interested you can try with my current working copy here: jsviews.zip

But bear in mind it is not yet full tested, and there is some work in progress within it, in other areas. Also some breaking changes, so you may not be able to run with it without the documented changes…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Sorting Algorithms Compared - Cprogramming.com
Sorting algorithms are usually judged by their efficiency. In this case, efficiency refers to the algorithmic efficiency as the size of the input...
Read more >
Sorting Algorithms: Slowest to Fastest! | by Dhanam Parekh
Revise these sorting algorithms along with their performance analysis.
Read more >
Sorting algorithm - Wikipedia
In computer science, a sorting algorithm is an algorithm that puts elements of a list into ... based on comparisons, such as counting...
Read more >
Performance of Sorting Algorithms :: CC 310 Textbook
Performance of Sorting Algorithms. We introduced four sorting algorithms in this chapter: selection sort, bubble sort, merge sort, and quicksort.
Read more >
Tuning sort performance - IBM
Techniques for managing sort performance · Determine which database in the instance has the largest sortheap value. · Determine the average size of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found