I have a website with over 500 elements (e.g. blog post) to be sorted according to publishing date, rating etc.
I tried to sort the 500 contents with javascript. But it is so slow, the page froze for 3 seconds when sorting and taking a lot of CPU.
I am using bubble sort right now, but I doubt other sort methods will have a huge difference as it's only n^2 vs nlogn.
Is there a better approach to sort by javascript? Or should I do it in backend (i.e. with PHP)? Thanks!
And also, how do good CMS usually do the sorting when there are many elements?