Spec-Zone.ru › Deno 2

Performance

Measure, analyze, and optimize application performance.

Eg performance


interface Performance

Deno supports User Timing Level 3 which is not widely supported yet in other runtimes.

Check out the Performance API documentation on MDN for further information about how to use the API.

Methods

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").

Properties

timeOrigin: number
readonly

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.

clearResourceTimings(): void

Removes all performance entries with an entryType of "resource" from the performance timeline and sets the size of the performance resource data buffer to zero.

Note: Deno does not currently track resource timings, so this method has no observable effect. It is provided for API compatibility.

setResourceTimingBufferSize(maxSize: number): void

Sets the desired size of the browser's resource timing buffer which stores the "resource" performance entries.

Note: Deno does not currently track resource timings, so this method has no observable effect. It is provided for API compatibility.

getEntries(): PerformanceEntryList
getEntriesByName(
name: string,
type?: string,
): PerformanceEntryList
getEntriesByType(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 fractional milliseconds.

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

Returns a JSON representation of the performance object.

variable Performance

The constructor object for Performance.

The Performance instance is accessed via the global performance property rather than constructed directly, so calling the constructor throws.

Properties

prototype: Performance
readonly

interface PerformanceEntry

Encapsulates a single performance metric that is part of the performance timeline. A performance entry can be directly created by making a performance mark or measure (for example by calling the .mark() method) at an explicit point in an application.

Properties

duration: number
readonly
entryType: string
readonly
name: string
readonly
startTime: number
readonly

Methods

toJSON(): any

variable PerformanceEntry

Encapsulates a single performance metric that is part of the performance timeline. A performance entry can be directly created by making a performance mark or measure (for example by calling the .mark() method) at an explicit point in an application.

Properties

prototype: PerformanceEntry
readonly

interface PerformanceMark

extends PerformanceEntry

PerformanceMark is an abstract interface for PerformanceEntry objects with an entryType of "mark". Entries of this type are created by calling performance.mark() to add a named DOMHighResTimeStamp (the mark) to the performance timeline.

Properties

detail: any
readonly
entryType: "mark"
readonly

variable PerformanceMark

PerformanceMark is an abstract interface for PerformanceEntry objects with an entryType of "mark". Entries of this type are created by calling performance.mark() to add a named DOMHighResTimeStamp (the mark) to the performance timeline.

Properties

prototype: PerformanceMark
readonly

interface PerformanceMarkOptions

Options which are used in conjunction with performance.mark. Check out the MDN performance.mark() documentation for more details.

Properties

detail: any
optional

Metadata to be included in the mark.

startTime: number
optional

Timestamp to be used as the mark time.

Properties

detail: any
optional

Metadata to be included in the mark.

startTime: number
optional

Timestamp to be used as the mark time.


interface PerformanceMeasure

extends PerformanceEntry

PerformanceMeasure is an abstract interface for PerformanceEntry objects with an entryType of "measure". Entries of this type are created by calling performance.measure() to add a named DOMHighResTimeStamp (the measure) between two marks to the performance timeline.

Properties

detail: any
readonly
entryType: "measure"
readonly

variable PerformanceMeasure

PerformanceMeasure is an abstract interface for PerformanceEntry objects with an entryType of "measure". Entries of this type are created by calling performance.measure() to add a named DOMHighResTimeStamp (the measure) between two marks to the performance timeline.

Properties

prototype: PerformanceMeasure
readonly

interface PerformanceMeasureOptions

Options which are used in conjunction with performance.measure. Check out the MDN performance.mark() documentation for more details.

Properties

detail: any
optional

Metadata to be included in the measure.

start: string | number
optional

Timestamp to be used as the start time or string to be used as start mark.

duration: number
optional

Duration between the start and end times.

end: string | number
optional

Timestamp to be used as the end time or string to be used as end mark.

Properties

detail: any
optional

Metadata to be included in the measure.

start: string | number
optional

Timestamp to be used as the start time or string to be used as start mark.

duration: number
optional

Duration between the start and end times.

end: string | number
optional

Timestamp to be used as the end time or string to be used as end mark.


interface PerformanceObserver

Observes performance measurement events and is notified of new PerformanceEntry objects as they are recorded in the performance timeline.

Methods

disconnect(): void

Stops the observer from receiving any further performance entries.

observe(options?: { entryTypes?: string[]; type?: string; buffered?: boolean; }): void

Specifies the set of performance entry types to observe.

takeRecords(): PerformanceEntry[]

Returns the current list of buffered performance entries, emptying it.

variable PerformanceObserver

Observes performance measurement events and is notified of new PerformanceEntry objects as they are recorded in the performance timeline.

Properties

prototype: PerformanceObserver
readonly
supportedEntryTypes: readonly string[]
readonly

interface PerformanceObserverCallback

The callback invoked when the observed set of performance entries grows.

Call Signatures

(
list: PerformanceObserverEntryList,
observer: PerformanceObserver,
): void

interface PerformanceObserverEntryList

A list of PerformanceEntry objects passed to a PerformanceObserver callback via its observe() method.

Methods

getEntries(): PerformanceEntry[]

Returns all explicitly observed performance entries.

getEntriesByName(
name: string,
type?: string,
): PerformanceEntry[]

Returns the observed performance entries with the given name.

getEntriesByType(type: string): PerformanceEntry[]

Returns the observed performance entries with the given entry type.

variable PerformanceObserverEntryList

A list of PerformanceEntry objects passed to a PerformanceObserver callback via its observe() method.

Properties

prototype: PerformanceObserverEntryList
readonly

type alias PerformanceEntryList

Definition

PerformanceEntry[]

variable performance

The global Performance instance, providing access to high-resolution timing via performance.now() and the user-timing marks and measures APIs.

Type

Performance

© 2018–2025 the Deno authors
Licensed under the MIT License.
https://docs.deno.com/api/web/performance

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API