If environment is SP 2013 and it is needed to count total items in any view pages like AllItems.aspx, then the fastest way is following
ctx.ListData.Row.length
It will return totals items in this view.
Regarding this answer
It is the optimum way to get total items in a view I guess. Following is the process to get items from view
- Need the CAML query from the view
- Using this CAML query all items can be retrieved
So minimum request is mandatory.
If the CAML query of this view is already know to you, then you can retrieve all items by single request.
ViewPage.aspx? what is the SharePoint version? – Atish Kumar Dipongkor Dec 08 '15 at 06:03