@editora/performance
v1.0.8
Published
Performance optimization utilities for Editora Rich Text Editor
Maintainers
Readme
@editora/performance
[!IMPORTANT] Live Website: https://editora-ecosystem.netlify.app/
Storybook: https://editora-ecosystem-storybook.netlify.app/
Performance and memory utilities for Editora editors.
Installation
npm install @editora/performance @editora/coreExports
From @editora/performance:
TransactionBatcher,createTransactionBatcherDebouncer,createDebouncer,debounceMemoryManager,createMemoryManager,getGlobalMemoryManagerPerformanceMonitor,createPerformanceMonitor,getGlobalPerformanceMonitor
Transaction Batching
import { createTransactionBatcher } from "@editora/performance";
const batcher = createTransactionBatcher({
maxBatchSize: 10,
maxBatchTime: 16,
enabled: true,
});
batcher.setOnFlush((transactions) => {
// apply grouped editor updates
});Debouncing
import { createDebouncer, debounce } from "@editora/performance";
const debouncer = createDebouncer(120);
debouncer.execute(() => {
// expensive update
});
const onResize = debounce(() => {
// recalc layout
}, 150);Memory Management
import { createMemoryManager } from "@editora/performance";
const memory = createMemoryManager({
maxMemoryMB: 100,
cleanupIntervalMs: 30000,
autoCleanup: true,
});
const timeoutId = window.setTimeout(() => {}, 1000);
memory.registerTimeout(timeoutId);Performance Monitoring
import { createPerformanceMonitor } from "@editora/performance";
const monitor = createPerformanceMonitor({
enabled: true,
sampleInterval: 5000,
maxSamples: 100,
logWarnings: true,
});
monitor.startOperation("render");
// render work
monitor.endOperation();Notes
- Utilities are browser-oriented (
window,performanceAPIs). - Keep monitor enabled in dev/staging and tune in production.
