UNPKG

@hiddentao/clockwork-engine

Version:

A TypeScript/PIXI.js game engine for deterministic, replayable games with built-in rendering

39 lines 1.64 kB
/** * Measures the execution time of a callback function using the Performance API * @param label - A descriptive label for the measurement * @param callback - The function to measure * @returns The result of the callback function */ export declare function measureTime<T>(label: string, callback: () => T): T; /** * Async version for measuring asynchronous operations * @param label - A descriptive label for the measurement * @param callback - The async function to measure * @returns The result of the callback function */ export declare function measureTimeAsync<T>(label: string, callback: () => Promise<T>): Promise<T>; /** * Advanced timing function that returns both result and timing information * @param label - A descriptive label for the measurement * @param callback - The function to measure * @param logger - Optional custom logging function * @returns Object containing the result and timing information */ export declare function measureTimeWithResult<T>(label: string, callback: () => T, logger?: (message: string) => void): { result: T; elapsed: number; label: string; }; /** * Async version of measureTimeWithResult * @param label - A descriptive label for the measurement * @param callback - The async function to measure * @param logger - Optional custom logging function * @returns Object containing the result and timing information */ export declare function measureTimeWithResultAsync<T>(label: string, callback: () => Promise<T>, logger?: (message: string) => void): Promise<{ result: T; elapsed: number; label: string; }>; //# sourceMappingURL=performance.d.ts.map