Zend views usually render instantly, but with a large dataset; 1500 objects into a xml view, it takes 2-3 seconds which is unacceptable for my app. Any suggestions would be greatly appreciated.
Zend views usually render instantly, but with a large dataset; 1500 objects into a
Share
600 KB can or can not force an application to execute slow. The execution time depends on the actual script, its persistence layer, connections from web- to database-server and more aspect. Thus:
First of all, instrument your application in such a way, that it computes the time taken by the server-side script.
For example, rename
index.phptorealIndex.phpand create a newindex.phplike this:Certainly, this approach is trivial and does not work in each and any situation. Nevertheless, it is a starting point.
Try to return few data
Often, huge numbers of data items – wether or not as XML – express bad UX and technical design
Therefore I propose to process as much data at the server-side and return a condensed data set to the client. Don’t forget: You database system is more or less always faster than your script, when it comes to retrieving and processing data.
Since users won’t be able to actually mentally understand all data form a 1500 item web-page, I’d propose to page the resulting view’s data. Retrieve 1/10 of the big data set and provide navigation control to go to previous or next page(s).
Note, that this not only helps users, it also reduces the amount of data, your database needs to scan and retrieve – if the database is well defined. E.g. indexes attributes to be searched and tries to keep records in tables of fixed size, etc…