perf: add caching system for fast graph loading
Major performance improvements for graph visualization: Cache System: - Add cache.lua module that stores parsed links/tags per file - Only re-parse files that have been modified (mtime check) - Cache stored in .ideadrop-graph-cache.json in idea_dir - Fast file scanning using vim.fs.find when available Layout Optimizations: - Reduce max iterations from 300 to 100 - Faster convergence with adjusted parameters - Barnes-Hut approximation for large graphs (100+ nodes) - Cache math functions locally for speed - Skip distant node pairs in repulsion calculation - Reuse visible_nodes array across iterations New Commands: - :IdeaGraph rebuild - Force full cache rebuild - :IdeaGraphClearCache - Clear cache file This makes opening the graph nearly instant for previously scanned vaults, similar to Obsidian's behavior.
This commit is contained in:
@@ -439,9 +439,9 @@ function M.open(opts)
|
||||
-- Build graph data
|
||||
local config = require("ideaDrop.core.config")
|
||||
local idea_dir = vim.fn.expand(config.options.idea_dir or "")
|
||||
vim.notify(string.format("Building graph from: %s", idea_dir), vim.log.levels.INFO)
|
||||
vim.notify(string.format("🕸️ Loading graph from: %s", idea_dir), vim.log.levels.INFO)
|
||||
|
||||
state.graph = data.build_graph()
|
||||
state.graph = data.build_graph(opts.force_rebuild)
|
||||
|
||||
if #state.graph.node_list == 0 then
|
||||
vim.notify(
|
||||
|
||||
Reference in New Issue
Block a user