javascript - Array sorting in Front-end or Back-end -


i implementing restful api returns array. want know if more efficient sort array in descending order in backend code or in javascript?

your api used n clients. performance-wise make sense have each client sorting on own instead of having server n clients. simply, less cpu work server.

furthermore, whether result needs sorted or not depends on nature of application using data. let application decide that.

however not overthink performance part before have performance problem. data sorting not costly or sorting has been done depending on how information kept internally (in dbms-s, example).

edit

with 20 rows without sorting, makes no important difference - make api implementing developers' life easier , small sorting on backend side.


Comments

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -