I have a bunch of objects that I want to create records from and save to localStorage. Model + Store + Proxy... all good there, but if I have a LOT of objects to save (e.g. 5000), how can I make sure the records all get built, THEN saved all at once to localStorage really quickly?
My guess is that if I do it in batch, localStorage writes will block the thread for less time.
Thanks @Mitchell, but I'm not seeing any improvement when I follow your advice. Is there something else I could be doing wrong? Here are the numbers I'm seeing in Chrome on my year-old MacBook Pro (i7). Adding just over 3000 records with about 5 fields per record is taking:
~60 seconds with autoSync turned on
~60 seconds if I turn autoSync off, add the records, then sync
~1/4 of a second with no syncing at all
At just over 50 records/second, I have to assume I'm doing something horribly wrong.
Please help
@Mitchell, I created a test case that better represents what I'm talking about. It compares the performance of the OOTB behavior (for each record, encode, then write) against pre-encoding all of the key->value records in a batch then writing them all at once. I would be grateful for any comments or advice.