Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/deno/cli/tsc/dts/lib.deno.shared_globals.d.ts>Performance

A modern runtime for JavaScript and TypeScript.
Go to Latest
class Performance
extends EventTarget
import { Performance } from "https://deno.land/x/deno@v1.32.3/cli/tsc/dts/lib.deno.shared_globals.d.ts";

Constructors

new
Performance()

Properties

readonly
timeOrigin: number

Returns a timestamp representing the start of the performance measurement.

Methods

clearMarks(markName?: string): void

Removes the stored timestamp with the associated name.

clearMeasures(measureName?: string): void

Removes stored timestamp with the associated name.

getEntriesByName(name: string, type?: string): PerformanceEntryList
mark(markName: string, options?: PerformanceMarkOptions): PerformanceMark

Stores a timestamp with the associated name (a "mark").

measure(measureName: string, options?: PerformanceMeasureOptions): PerformanceMeasure

Stores the DOMHighResTimeStamp duration between two marks along with the associated name (a "measure").

measure(
measureName: string,
startMark?: string,
endMark?: string,
): PerformanceMeasure

Stores the DOMHighResTimeStamp duration between two marks along with the associated name (a "measure").

now(): number

Returns a current time from Deno's start in milliseconds.

Use the permission flag --allow-hrtime return a precise value.

const t = performance.now();
console.log(`${t} ms since start!`);
toJSON(): any

Returns a JSON representation of the performance object.