altmp / altv-client-js

Official clientside JavaScript runtime for alt:V
6 stars 7 forks source link

Add benchmark class #48

Open LeonMrBonnie opened 3 years ago

LeonMrBonnie commented 3 years ago

A simple class for doing precise benchmarking, for situations where milliseconds are not accurate enough. Only clientside and not shared, because NodeJS already has a lot of profiling options.

Typings:

export const enum Precision {
    Milliseconds,
    Microseconds,
    Nanoseconds
}
export class Benchmark {
    constructor(autoStart: boolean = true);

    public start(): void;
    public stop(): void;

    public getResult(precision: Precision): number;
}