8000 perf: skip page cache allocation for BrowserDb (WASM/IndexedDB backend) · Issue #275 · project-minigraf/minigraf · GitHub
[go: up one dir, main page]

Skip to content

perf: skip page cache allocation for BrowserDb (WASM/IndexedDB backend) #275

Closed

Description

@adityamukho

Problem

BrowserDb::open_in_memory(), BrowserDb::open(), and BrowserDb::import_graph() all call PersistentFactStorage::new(buffer, 256) with a 256-page capacity. The backend is BrowserBufferBackend — an in-memory HashMap<u64, Vec<u8>> that pre-loads all pages from IndexedDB at open time. Every subsequent page read is a RAM-to-RAM copy through the LRU cache, which adds HashMap overhead for zero benefit.

Related

Companion to #274 (same issue for native in-memory databases). Fix location is different — src/browser/mod.rs lines 54, 79, 219.

Proposed fix

Pass 0 as the page_cache_capacity argument to PersistentFactStorage::new in all three BrowserDb constructors. BrowserBufferBackend is already a page cache; the PageCache layer is redundant.

Acceptance criteria

  • BrowserDb::open_in_memory(), BrowserDb::open(), and BrowserDb::import_graph() pass 0 as page cache capacity.
  • All existing browser WASM tests pass unchanged.
  • OpenOptions::page_cache_size documentation notes it is native file-backed only.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    performanceBenchmark performance regressions

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0