So I have a mission in making pages faster and faster and here is my thoughts and I would really like some feedback and comments to discuss if this is a really bad way or if it is a really smart way :)
I have a Data Collection with 1,000 records and I added those records to a table on my page using the $table.rows. Then I just made the code different so that it would split all data up in pages with 25 records on every page. I added a pager so the user can browse through all 40 pages with dummy data.
But I thought that the page loads a bit slow so I started to think about some way of making my own Data Collection Cache on top of the already great cache mechanism. What did I do?
I take the first 25 records as the JSON object needed for the table and I just store the whole chunk of that in a Data Collection I call Cache. Then when a user hits my page I just load the last available record from that Data Collection and populate the table.
Now I think I saw some great increase in performance because the data reads one record and it is already formatted for the table so it performs really fast I think.
First version where I populate from data through backend code but still read records from the Data Collection was between 6.6 seconds up to 9.4 seconds on GTMetrix for a fully loaded page. This is really fast I think, then I went to Pingdom to test the load time without regards to the fully loaded and went from 2 seconds down to 309 ms and that is like my personal record in Wix.
So the version where I cache JSON in a separate Data Collection is fully loaded at 4.4 seconds and that is around 60% faster than the already fast one.
Getting a page speed score of 98% at GTMetrix is kind of hard in my experience.
So what I will do now is to create a Data Hook that will will refresh the cached data in the background on a schedule so I know that the users get the freshest data but maybe cached for 4 hours or even 24 hours depending on the usage.
So what is your feedback on this?
Try it and see what you think, is this a faster way to store all records in one cached field for the start page of my site or is it just me playing around like an amateur as usual? :)
Well, anyway, happy coding in the greatest platform of all times!