Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Array sorting in Front-end or Back-end [closed]

I am implementing a RESTful API that returns an array. I want to know if it will be more efficient to sort the array in descending order in my backend code or in the javascript?

like image 688
edash Avatar asked Apr 14 '17 15:04

edash


1 Answers

I would actually try to hand it off to the database. Write the query where the array returned from the DB is already sorted. The most computing power and most efficient sorting is probably on the DB.

This goes to sorting, filtering in general IMO.

like image 100
Miklós Mátyás Avatar answered Oct 13 '22 21:10

Miklós Mátyás