AGENT SKILL

obsidian-performance-tuning

Optimize Obsidian plugin performance for smooth operation. Use when experiencing lag, memory issues, or slow startup, or when optimizing plugin code for large vaults. Trigger with phrases like "obsidian performance", "obsidian slow", "optimize obsidian plugin", "obsidian memory usage".

License 许可
MIT
最近更新
2026-05-26
Stars
★ 0
Forks
0

01 前言 Front Matter

name
obsidian-performance-tuning
author
Jeremy Longshore <jeremy@intentsolutions.io>
license
MIT
version
1.0.0
description
Optimize Obsidian plugin performance for smooth operation. Use when experiencing lag, memory issues, or slow startup, or when optimizing plugin code for large vaults. Trigger with phrases like "obsidian performance", "obsidian slow", "optimize obsidian plugin", "obsidian memory usage".
allowed-tools
Read, Write, Edit
compatible-with
claude-code, codex, openclaw

02 资源文件 1

03 SKILL.md 正文

Obsidian Performance Tuning

Contents

Overview

Optimize Obsidian plugin performance for smooth operation in large vaults using lazy loading, efficient file processing, and proper event handling.

Prerequisites

  • Working Obsidian plugin
  • Developer Tools access (Ctrl/Cmd+Shift+I)
  • Understanding of async JavaScript

Performance Benchmarks

Metric Good Warning Critical
Plugin load time < 100ms 100-500ms > 500ms
Command execution < 50ms 50-200ms > 200ms
File operation < 10ms 10-50ms > 50ms
Memory increase < 10MB 10-50MB > 50MB

Instructions

Step 1: Profile Performance

Add timing instrumentation to identify bottlenecks. Measure plugin load, command execution, and file operations.

Step 2: Implement Lazy Initialization

Defer expensive operations (index building, large data loading) until first actual use rather than loading in onload().

Step 3: Process Files Efficiently

Use vault.cachedRead(), process files in chunks (50 at a time) with pauses for UI updates, and cache results by mtime.

Step 4: Use Memory-Efficient Structures

LRU cache for bounded memory, WeakMap for garbage-collectible references, string interning for repeated values.

Step 5: Optimize Event Handlers

Debounce file modification handlers (500ms), throttle scroll handlers (100ms), batch rapid events into single callbacks.

Step 6: Optimize UI Rendering

Use DocumentFragment for batch DOM updates, implement virtual scrolling for long lists, use requestAnimationFrame for smooth updates.

See detailed implementation for profiler, lazy service, file processor, LRU cache, event optimizer, and render optimizer code.

Output

  • Performance profiler identifying bottlenecks
  • Lazy initialization reducing load time
  • Chunked file processing preventing UI freezes
  • Bounded memory usage with LRU caches

Error Handling

Issue Cause Solution
Plugin slow to load Heavy initialization Use lazy loading pattern
UI freezes Blocking operations Use async + chunking
Memory growth Unbounded caching Use LRU cache with size limit
Event lag Unthrottled handlers Debounce/throttle events

Examples

Pre-Release Performance Checklist

  • [ ] Plugin loads in < 100ms
  • [ ] No blocking operations in onload()
  • [ ] File operations use cachedRead
  • [ ] Event handlers debounced/throttled
  • [ ] Caches have size limits
  • [ ] Works smoothly with 1000+ files

Resources

Next Steps

For resource optimization, see obsidian-cost-tuning.

04 同仓库更多 Skills

SamuelChien
SamuelChien/mega-skills-collection

zustand-store-ts

Create Zustand stores with TypeScript, subscribeWithSelector middleware, and proper state/action separation. Use when building React state management, creating global stores, or implementing reactive state patterns with Zustand.

★ 0
SamuelChien
SamuelChien/mega-skills-collection

zustand-store-creator

Zustand Store Creator - Auto-activating skill for Frontend Development. Triggers on: zustand store creator, zustand store creator Part of the Frontend Development skill category.

★ 0
SamuelChien
SamuelChien/mega-skills-collection

zero-trust-config-helper

Zero Trust Config Helper - Auto-activating skill for Security Advanced. Triggers on: zero trust config helper, zero trust config helper Part of the Security Advanced skill category.

★ 0
SamuelChien
SamuelChien/mega-skills-collection

zapier-integration-helper

Zapier Integration Helper - Auto-activating skill for Business Automation. Triggers on: zapier integration helper, zapier integration helper Part of the Business Automation skill category.

★ 0
SamuelChien
SamuelChien/mega-skills-collection

zai-cli

Execute z.AI CLI providing vision, search, reader, and GitHub exploration via CLI and MCP. Use when user needs image/video analysis, OCR, UI-to-code conversion, error diagnosis, real-time web search, web page to markdown extraction, or GitHub code exploration. Trigger with phrases like "analyze this image", "search the web for", "read this page", "explore this repo", or "use zai". Requires Z_AI_API_KEY.

★ 0
SamuelChien
SamuelChien/mega-skills-collection

yt-research

Research competitor YouTube channels, niches, and trending topics for your content strategy. Use this skill whenever the user says "research channels", "analyze competitors", "find trending topics", "niche analysis", "competitive research", "what are other creators doing", "scrape YouTube channels", or wants to understand the competitive landscape for a specific tool or topic area. Use when working with yt research. Trigger with 'yt', 'research'.

★ 0