-
Notifications
You must be signed in to change notification settings - Fork 2
Performance and Caching
Complete guide to endpoint.nvim's caching system and performance optimization.
endpoint.nvim provides three intelligent caching modes to balance performance and data freshness.
require("endpoint").setup({
cache = {
mode = "none"
}
})Note
This is the default mode - always returns the most up-to-date results by scanning files in real-time.
When to use:
- ✅ Small projects (< 100 endpoints)
- ✅ Active development with frequent endpoint changes
- ✅ When you need guaranteed fresh results
Performance:
- Real-time scanning on every search
- No memory or disk usage
- Slight delay on large codebases
require("endpoint").setup({
cache = {
mode = "session"
}
})Tip
Best balance of performance and freshness for most projects. Cache persists until you close Neovim.
When to use:
- ✅ Medium projects (100-1000 endpoints)
- ✅ Most development workflows
- ✅ Balance of performance and freshness
Performance:
- First scan builds cache, subsequent searches are instant
- Memory usage: ~1-5MB for typical projects
- Cache invalidated when Neovim closes
require("endpoint").setup({
cache = {
mode = "persistent"
}
})Warning
Use only for large, stable projects. Cache may become stale if you frequently add/remove endpoints.
When to use:
- ✅ Large projects (1000+ endpoints)
- ✅ Stable codebases with infrequent endpoint changes
- ✅ Team environments with consistent project structure
Performance:
- Instant loading on subsequent Neovim sessions
- Disk cache survives restarts and reboots
- Cache location:
~/.local/share/nvim/endpoint.nvim/[project-name]/
:Endpoint ClearCache " Clear all cached data
:Endpoint CacheStatus " Show current cache statisticsTip
Use :Endpoint CacheStatus to see detailed information about your cache performance and hit rates.
The :Endpoint CacheStatus command shows:
- Cache mode: Current caching strategy
- Endpoints by method: Breakdown of cached GET, POST, PUT, DELETE, PATCH endpoints
- Cache timestamps: When data was last updated
- Hit/miss statistics: Cache performance metrics
- Memory usage: Current cache memory footprint
- Disk usage: Size of persistent cache files (persistent mode only)
require("endpoint").setup({
cache = {
mode = "none" -- Real-time is fast enough
},
picker = {
type = "vim_ui_select" -- Lightweight picker
}
})Note
Small projects don't need caching. The overhead of cache management may actually slow things down.
require("endpoint").setup({
cache = {
mode = "session" -- Perfect balance
},
picker = {
type = "telescope" -- Rich features worth the cost
}
})Tip
This is the sweet spot configuration for most development workflows.
require("endpoint").setup({
cache = {
mode = "persistent" -- Essential for large codebases
},
picker = {
type = "snacks" -- Modern and efficient
}
})Warning
Monitor cache freshness in large projects. Consider clearing cache after major refactoring.
require("endpoint").setup({
cache = {
mode = "persistent"
-- Each project gets its own cache
}
})Note
Each project directory gets its own cache, so monorepos work efficiently without cache conflicts.
Note
endpoint.nvim automatically detects when files need re-scanning in persistent mode.
Triggers:
- File modifications in source directories
- New files matching framework patterns
- Project structure changes
- Configuration changes
:Endpoint ClearCacheTip
Clear cache after major refactoring, framework upgrades, or when results seem stale.
-- Cache is automatically invalidated when:
-- 1. Source files are newer than cache
-- 2. Project structure changes
-- 3. Framework detection results changeWarning
If searches are slow, check these common issues:
-
Large project without caching:
cache = { mode = "none" } -- Change to "session" or "persistent"
-
Too many files being scanned:
- Check exclude patterns in framework implementations
- Verify ripgrep isn't scanning build/dist directories
-
Complex regex patterns:
- Framework patterns may be too broad
- Check ripgrep command with debug mode
Note
Session cache memory usage is typically 1-5MB for normal projects.
If memory usage is high:
-
Check cache size:
:Endpoint CacheStatus
-
Clear cache periodically:
:Endpoint ClearCache
-
Use persistent mode for very large projects:
cache = { mode = "persistent" } -- Moves data to disk
Tip
If you're seeing outdated results, the cache may be stale.
Solutions:
-
Clear cache manually:
:Endpoint ClearCache
-
Switch to more aggressive invalidation:
cache = { mode = "session" } -- Instead of "persistent"
-
Use real-time mode for active development:
cache = { mode = "none" } -- No caching
ENDPOINT_DEBUG=1 nvim -c "Endpoint All"Note
Debug mode shows detailed timing information for cache operations and search performance.
Debug output includes:
- Cache hit/miss information
- Search command execution time
- File scanning statistics
- Memory usage changes
-- Add to your config for performance monitoring
vim.g.endpoint_debug = true
-- Then check :messages after searches to see timingTip
Use debug mode to identify performance bottlenecks in your specific project setup.
~/.local/share/nvim/endpoint.nvim/
├── my-spring-project/
│ ├── endpoints.json # Cached endpoint data
│ ├── metadata.json # Cache metadata
│ └── framework.txt # Detected framework
├── my-nestjs-project/
│ └── ...
└── my-rails-project/
└── ...
Note
Each project gets its own cache directory based on the project root path.
{
"version": "1.0",
"framework": "spring",
"timestamp": 1634567890,
"endpoints": {
"GET": [
{
"method": "GET",
"endpoint_path": "/api/users",
"file_path": "src/main/java/UserController.java",
"line_number": 15,
"column": 5
}
]
}
}Warning
Don't manually edit cache files. Use :Endpoint ClearCache to reset if needed.
-
Start with session mode:
cache = { mode = "session" }
-
Use real-time during active endpoint development:
cache = { mode = "none" } -- When adding many new endpoints
-
Switch to persistent for stable projects:
cache = { mode = "persistent" } -- After major development phases
Tip
You can change cache modes dynamically and restart Neovim to apply changes.
Note
Each developer's cache is independent. Cache settings don't affect team members.
Recommended team setup:
require("endpoint").setup({
cache = { mode = "session" }, -- Good default for all team members
-- Let individuals optimize based on their workflow
})Warning
Don't commit cache directories to version control.
Add to .gitignore:
# endpoint.nvim cache
.endpoint-cache/