zen-fs / dom

DOM backends for ZenFS
https://zen-fs.github.io/dom/
MIT License
11 stars 2 forks source link

Tips for improving perceived importance when loading large filesystem from IndexedDB? #17

Open robert-westenberger opened 1 month ago

robert-westenberger commented 1 month ago

Hi, I am using the IndexedDB backend in a very simple configuration:

import { configure } from "@zenfs/core";
import { IndexedDB } from '@zenfs/dom';

export async function createFilesystem() {
  await configure({
    mounts: {
      "/": {backend: IndexedDB, storeName: "foo", name: "foo"}
    }
  });
}

I call that createFilesystem function before I render my app. If I have a large amount of data stored in IndexedDB, when the page loads it might be several seconds before the filesystem is usable.

Is there any recommendation for improving "perceived" performance when loading the filesystem with a large amount of data?

When my app loads for the first time, I only need to access files in one specific directory... is there any way to load just those files and lazy load / stream the rest? Or something else?? Thank you

james-pre commented 1 month ago

@robert-westenberger,

You can disable the preloading using disableAsyncCache. Please note that this will disable sync functions, but will also speed up loading times (perhaps down to only a few ms).