Repository navigation
perf: skip page cache allocation for in-memory databases - #341
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
MemoryBackend serves every read and write directly from RAM and never consults the page cache, so honoring OpenOptions::page_cache_size for in_memory_with_options was pointless. Always construct the PageCache with zero capacity for MemoryBackend-backed storage, and document page_cache_size as file-backed-only. Adds pub(crate) capacity() / page_cache_capacity() test accessors on PageCache / PersistentFactStorage to verify the wiring. Closes #274 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YMWSutMLJJ7Y5b8hs9ZaCU
adityamukho
force-pushed
the
274-inmemory-page-cache
branch
from
August 23, 2026 17:08
dbb0c6f to
33423fa
Compare
adityamukho
added a commit
that referenced
this pull request
Oct 7, 2026
…the IndexedDB flush (#470) checkpoint(), importGraph() and every write collected dirty pages with read_page_raw(id).ok() in a filter_map, so a page that failed to read was silently left out of the flush to IndexedDB while the call reported success. A shared take_dirty_pages helper (the same one v3 has since #469) now returns the read error. No current path leaves a dirty id without a page (ids enter the dirty set only after the page is stored), so this is defensive rather than a fix for observed loss. The browser unit tests did not compile on wasm32 (a duplicate page_cache_capacity from #341/#342, and dir_sync tests using tempfile); both are fixed so the two new regression tests run. Claude-Session: https://claude.ai/code/session_015GgLEs8YozJjYhwPEYgTUn Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
MemoryBackendserves every read/write directly from RAM and never consults the page cache, soMinigraf::in_memory_with_optionswas pointlessly honoringOpenOptions::page_cache_sizewhen constructingPersistentFactStorage.PageCachewith zero capacity, via a newmemory_page_cache_capacity()helper, regardless of whatpage_cache_sizewas set to.OpenOptions::page_cache_size(field and builder method) andMinigraf::in_memory_with_optionsare now documented as file-backed-only.pub(crate)test-only accessors (PageCache::capacity(),PersistentFactStorage::page_cache_capacity()) to verify the wiring end-to-end.This is a safe, no-op change with no semantic impact on query results —
MemoryBackendnever exercises the page-cache code path.Closes #274
Test plan
db::tests::test_in_memory_page_cache_size_ignored(watched RED before implementing, then GREEN)persistent_facts::tests::test_page_cache_capacity_reflects_constructed_valuecargo test— 681 unit tests + all integration/doc tests passcargo clippy --all-features -- -D warnings— cleancargo fmt --check— cleansrc/browser/mod.rs(separate issue perf: skip page cache allocation for BrowserDb (WASM/IndexedDB backend) #275)🤖 Generated with Claude Code
https://claude.ai/code/session_01YMWSutMLJJ7Y5b8hs9ZaCU