View Full Version : Which is faster?
1. Using session objects to store the html string of a table:
Example: "<table>....</table>"
or use session objects to store an array, then construct the html string from it using a function.
2. Storing an array of data using session objects or use mysql_query to get the array everytime.
Thanks.
1. Using session objects to store the html string of a table:
Example: "<table>....</table>"
or use session objects to store an array, then construct the html string from it using a function.
storing the html-code should be faster then generating it from an array. the difference will probably be very minor though...
storing the data as an array leaves you more flexebility to sort the element, do computations with them, replace values of it etc. If you want to further proces the data like that, then leaving the data in an array is the better way to go.
2. Storing an array of data using session objects or use mysql_query to get the array everytime.
Thanks.
Getting the data from a session-array will be faster.
But there are limits --> sessionvariables can consume quite some runtime resources, so if you have a lott of simultanious session, then storing great amounts of data in sessionvariables will slow down the server.
DB's can of course contain much more data without require runtime resources to maintain it + the data is stored in a more persistent format.
By the way, here to, the differences will be quite small and probably insignificant for your applications overall performance.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.