feat: CSR graph caching for 2x algorithm speedup#10
Merged
dylanbstorey merged 4 commits intomainfrom Jan 10, 2026
Merged
Conversation
added 2 commits
January 9, 2026 20:08
Add in-memory CSR (Compressed Sparse Row) graph caching to accelerate graph algorithms by eliminating repeated SQLite I/O. Cache management: - gql_load_graph() - load graph into memory cache - gql_unload_graph() - free cache memory - gql_reload_graph() - refresh cache after modifications - gql_graph_loaded() - check cache status Algorithm changes: - Refactored all 17 graph algorithms to accept optional cached graph - When cache is loaded, algorithms use it automatically - Fallback to SQLite when cache not available Bindings: - Python: graph.load_graph(), unload_graph(), reload_graph(), graph_loaded() - Rust: Graph::load_graph(), unload_graph(), reload_graph(), graph_loaded() Performance (Apple M1 Max): - PageRank: 2.1-2.2x speedup with cache - Label Propagation: 2.0-2.1x speedup - Degree Centrality: 1.7-2.0x speedup Build improvements: - Added install-bundled target for Rust binding tests - Fixed ARM64 detection for macOS (arm64 vs aarch64)
- ADR-0003: Mark as decided - GPU acceleration not pursued - Metal provides no benefit (~1.0x) on Apple Silicon - CPU caching provides 2x speedup with minimal complexity - Document lessons learned from wgpu and Metal experiments - ADR-0004: Archive - GPU threshold config no longer relevant
added 2 commits
January 9, 2026 20:15
- Add perf cache-comparison and hop-depth benchmark tasks - Add GPU test task structure (for future use) - Update test-rust to rebuild bundled extension
- Add struct tag to csr_graph typedef for C type compatibility - Remove redundant serde_json import (clippy warning)
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
Performance
Benchmarks on Apple M1 Max show 2x speedup with caching enabled:
API
-- Load graph into memory cache
SELECT gql_load_graph();
-- Run algorithms (automatically use cache)
SELECT cypher('RETURN pageRank()');
-- Reload after modifications
SELECT gql_reload_graph();
-- Free cache memory
SELECT gql_unload_graph();
Python/Rust bindings expose equivalent methods: load_graph(), unload_graph(), reload_graph(), graph_loaded().