Commit de7b8ee8 authored by ligaowei's avatar ligaowei

Update UnifiedEventProcessor to use OptimizedEventProcessingService with object pooling

parent b41a4454
......@@ -2,16 +2,19 @@
import type { TimelineEvent } from '../types/timeline'
import { EventProcessingService } from './EventProcessingService'
import { EventDeduplicationService } from './EventDeduplicationService'
import { OptimizedEventProcessingService } from './OptimizedEventProcessingService'
export class UnifiedEventProcessor {
private eventProcessingService: EventProcessingService
private eventDeduplicationService: EventDeduplicationService
private optimizedEventProcessingService: OptimizedEventProcessingService
private eventHandlers: Array<(event: TimelineEvent) => void> = []
private processedEvents: TimelineEvent[] = []
constructor() {
this.eventProcessingService = new EventProcessingService()
this.eventDeduplicationService = new EventDeduplicationService()
this.optimizedEventProcessingService = new OptimizedEventProcessingService()
}
/**
......@@ -36,8 +39,8 @@ export class UnifiedEventProcessor {
// 处理事件类型转换
const processedEvent = this.eventProcessingService.processEventType(rawData)
// 标准化事件对象
const normalizedEvent = this.eventProcessingService.normalizeEvent(processedEvent)
// 标准化事件对象(使用优化的服务)
const normalizedEvent = this.optimizedEventProcessingService.normalizeEvent(processedEvent)
// 添加到已处理事件列表
this.processedEvents.push(normalizedEvent)
......@@ -94,4 +97,12 @@ export class UnifiedEventProcessor {
this.processedEvents = []
this.eventDeduplicationService.clearEventHashSet()
}
/**
* 获取性能统计信息
* @returns 性能统计信息
*/
getPerformanceStats(): { totalProcessed: number; totalReused: number; reuseRate: number } {
return this.optimizedEventProcessingService.getPerformanceStats();
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment