diff --git a/packages/memory-graph/CHANGELOG.md b/packages/memory-graph/CHANGELOG.md index 7589fe69..26dbb19e 100644 --- a/packages/memory-graph/CHANGELOG.md +++ b/packages/memory-graph/CHANGELOG.md @@ -80,4 +80,19 @@ NodeCache now cleans up deleted nodes properly #### Race Condition Fix Atomic node/edge updates eliminate NaN positions +#### Canvas Rendering Optimizations +Reduced per-frame overhead and improved rendering efficiency +- Spatial grid for hit detection +- Batched edge rendering by type (fewer canvas state changes) +- Canvas quality settings initialized once instead of every frame +- Optimized render key using fast hash instead of string concatenation +- Memoized nodeMap to avoid rebuilding every frame + +#### Node Limiting & Memory Management +Smart memory limiting prevents performance issues with large datasets +- `maxNodes` prop limits total memory nodes (default: 500 in playground) +- Dynamic per-document cap distributes budget across documents +- Prioritizes recent memories and high-relevance scores +- k-NN similarity limit reduced from 15 to 10 connections per document + --- \ No newline at end of file diff --git a/packages/memory-graph/src/components/memory-graph.tsx b/packages/memory-graph/src/components/memory-graph.tsx index 68c9dc5a..f7dd45b6 100644 --- a/packages/memory-graph/src/components/memory-graph.tsx +++ b/packages/memory-graph/src/components/memory-graph.tsx @@ -39,8 +39,8 @@ export const MemoryGraph = ({ selectedSpace: externalSelectedSpace, onSpaceChange: externalOnSpaceChange, memoryLimit, - isExperimental, maxNodes, + isExperimental, // Slideshow control isSlideshowActive = false, onSlideshowNodeChange, diff --git a/packages/memory-graph/src/constants.ts b/packages/memory-graph/src/constants.ts index ca51e913..29a27866 100644 --- a/packages/memory-graph/src/constants.ts +++ b/packages/memory-graph/src/constants.ts @@ -62,7 +62,7 @@ export const LAYOUT_CONSTANTS = { // Similarity calculation configuration export const SIMILARITY_CONFIG = { threshold: 0.725, // Minimum similarity (72.5%) to create edge - maxComparisonsPerDoc: 10, // k-NN: each doc compares with 15 neighbors (balanced performance) + maxComparisonsPerDoc: 10, // k-NN: each doc compares with 10 neighbors (optimized for performance) } // D3-Force simulation configuration