My question is about performance issues using localStorage and a possible workaround. As far as I understand (and I'm not too sure about this), as soon as the link to localStorage is displayed on the page (compilation time?), It blocks the stream and reads data from disk to fill up localStorage memory for reference, Or maybe it searches data on disk, if the domain stores data in the past and therefore knows that localstorage is already used there.
In any case, since the localstorage api is synchronous, it blocks the stream for reading from disk, leaving us to wait for the data to be read before the page can do anything else. Let's say we insert an iframe on a page that is dynamically loaded with another domain as the source. If we use this iframe to do all read and write localstorage through postMessage, as described in this post , will the thread be blocked only after loading the iframe? Does this give us an asynchronous method of using localstorage? Or am I completely disconnected?
source share