I am making an application in ionic framework, which makes web requests through a Web service. I have about 10,000 records, and maybe in a week 200 records and so on are increased. my problem is in the time required to load the information. there are sections within my application that takes too long to load the application, increasing the use of CPU and battery. if I keep records as .json the size is around 10Mb
I compress and decompress these records turning them into string and storing them in localStorage with the library "LZString". but apparently the use of this library consumes resources besides the "JSON.parse". that's how I was doing it with about 5000 records.
if I have kept records, unzip:
desc = LZString.decompress (window.localStorage.getItem ( 'var')) || ;
JSON.parse return (dec); // Desc has 5000 records
if I make the request for the first time, compress:
window.localStorage.setItem ( 'var' LZString.compress (JSON.stringify (objJson))); // ObjJson 5000 records.
Total: 4.82 MB
I can do to optimize the performance of my application and compress the information or something ?.
You could try breaking the items up in to smaller chunks/pages, maybe accessing 100 records at a time.
Another option would be to display the loading indicator while loading the data.
Please follow up if I am misunderstanding your question.