Skip to content

Comment on Why IndexedDB is slow and what to use instead

Comments

One thing I don't see called out as an option: CacheStorage (window.caches). Just store your data as Response. Fast, easy, available in Worker scope...

Doesn't solve rich data though as neatly as IndexedDB does.

Because IndexedDB uses structured clone, it can store javascript data as is, which includes storing correctly a number of interesting/useful types, including ArrayBuffers, Files/Blobs, CryptoKey instances (useful to avoid needing export flag on them), the cost of this is the performance hit compared to JSON.parse on a string.

Also the cache is less persistent than IndexedDB when storage pressure increases.

Not apparently all that durable, though, especially when you hit the storage limit.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.