I'm setting up a virtual file system based on IndexedDB in the browser client. My assumption is that it will be efficient storing typed arrays as values; in particular, I am saving 8 kB chunks of data via Int8Array. What means do I have to verify the effectiveness of this - actual space used, actual data representation?
For example, in Chromium I can see that the Int8Array seem to be properly preserved. But the 'Clear Storage' page shows a suspiciously high storage size - 91 kB - although the first test file I was writing is only 40 kB in size (40096 bytes spread across 5 keys, plus 24 bytes for a meta-data key). The keys are quite small arrays containing a short string path and a number. So it looks like the storage takes around twice as much as predicted:
In constrast, I cannot find any information in Firefox about the usage amount, but the storage browser shows only type 'Array' for the values, and they are represented very inefficiently as JSON objects, although that may be a display issue only:
A related question is, is there a difference between storing the ArrayBuffer objects as opposed to an Int8Array view on it? I tried both, and there is a mimimal difference in size (Chromium uses 90.8 kB instead of 90.9 kB if I use ArrayBuffer instead of Int8Array as value passed to IDB).


