34 lines
1.2 KiB
TypeScript
34 lines
1.2 KiB
TypeScript
import { FeatureId } from "../extend";
|
|
import { GeoJSONStoreFeatures, TerraDraw } from "../terra-draw";
|
|
import { Bench } from "tinybench";
|
|
type BenchmarkResult = {
|
|
name: string;
|
|
opsPerSecond: number;
|
|
averageTimeMs: number;
|
|
};
|
|
export declare const createPointFeatures: (n: number) => GeoJSONStoreFeatures[];
|
|
export declare const createDraw: () => TerraDraw;
|
|
type BenchmarkProps = {
|
|
draw: TerraDraw;
|
|
features: GeoJSONStoreFeatures[];
|
|
featureIds: FeatureId[];
|
|
randomFeatureId: FeatureId;
|
|
};
|
|
export type BenchmarkTask = {
|
|
name: string;
|
|
beforeEach: (benchmarkProps: BenchmarkProps) => void;
|
|
task: (benchmarkProps: BenchmarkProps) => void;
|
|
featureCount?: number;
|
|
loopCount?: number;
|
|
enabled?: boolean;
|
|
};
|
|
export declare const createBenchmark: (benmarkName: string, tasks: BenchmarkTask[]) => Bench;
|
|
export declare const processBenchmarks: (bench: Bench, benchmarkTasks: BenchmarkTask[]) => BenchmarkResult[];
|
|
export declare function writeBenchmarkSummary(results: BenchmarkResult[]): void;
|
|
export declare const logBenchmarkResults: (results: {
|
|
name: string;
|
|
opsPerSecond: number;
|
|
averageTimeMs: number;
|
|
}[]) => void;
|
|
export {};
|