@lcap/nasl
Version:
NetEase Application Specific Language
47 lines • 1.66 kB
TypeScript
/**
* Memory optimization utilities for deployment data
*/
/**
* 在标注过程中优化JSON对象,减少内存使用
* 这个函数专门用于集成到_toJSON过程中
*/
export declare function optimizeJsonDuringAnnotation(jsonObject: any): any;
/**
* 获取优化统计信息
*/
export declare function getOptimizationStats(): {
totalCalls: number;
propertiesRemoved: number;
emptyArraysRemoved: number;
undefinedValuesRemoved: number;
};
/**
* 重置优化统计信息
*/
export declare function resetOptimizationStats(): void;
/**
* Removes additional unnecessary properties from annotated JSON to reduce size
*
* 注意:此函数用于独立的JSON压缩场景。
* 在主要的标注流程中,优化已经集成到了 optimizeJsonDuringAnnotation 中,
* 以减少内存使用和处理时间。
*
* 使用场景:
* - 需要对已有的JSON对象进行后处理压缩
* - 第三方系统集成中需要压缩JSON数据
* - 测试和验证优化效果
*/
export declare function compactAnnotatedJson(annotatedJson: any): any;
/**
* Processes large objects in chunks to avoid memory spikes
*/
export declare function processInChunks<T, R>(items: T[], processor: (chunk: T[]) => Promise<R[]> | R[], chunkSize?: number): Promise<R[]>;
/**
* Splits large objects into smaller chunks for processing
*/
export declare function chunkLargeObject(obj: Record<string, any>, maxSize?: number): Record<string, any>[];
/**
* Memory-aware delay function that considers current memory usage
*/
export declare function smartDelay(baseDelay?: number): Promise<void>;
//# sourceMappingURL=memory-optimization.d.ts.map