mathrok
Version:
AI-powered symbolic mathematics library combining traditional Computer Algebra System (CAS) capabilities with natural language processing for math problem solving
53 lines • 1.29 kB
TypeScript
/**
* Cross-platform performance timing utility
* Provides consistent high-resolution timing across Node.js and browser environments
*/
/**
* Get high-resolution timestamp in milliseconds
* Uses performance.now() when available, falls back to Date.now()
*/
export declare function getHighResolutionTime(): number;
/**
* Performance timer class for measuring operation durations
*/
export declare class PerformanceTimer {
private startTime;
private endTime;
private isRunning;
/**
* Start the timer
*/
start(): void;
/**
* Stop the timer and return elapsed time in milliseconds
*/
stop(): number;
/**
* Get elapsed time in milliseconds
* If timer is still running, returns time since start
*/
elapsed(): number;
/**
* Reset the timer
*/
reset(): void;
/**
* Check if timer is currently running
*/
get running(): boolean;
}
/**
* Measure execution time of a function
*/
export declare function measureAsync<T>(fn: () => Promise<T>): Promise<{
result: T;
duration: number;
}>;
/**
* Measure execution time of a synchronous function
*/
export declare function measureSync<T>(fn: () => T): {
result: T;
duration: number;
};
//# sourceMappingURL=timer.d.ts.map