Performance: setResourceTimingBufferSize() method

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since September 2017.

Note: This feature is available in Web Workers.

The setResourceTimingBufferSize() method sets the desired size of the browser's resource timing buffer which stores the "resource" performance entries.

The specification requires the resource timing buffer initially to be 250 or greater.

To clear the browser's performance resource data buffer, use the Performance.clearResourceTimings() method.

To get notified when the browser's resource timing buffer is full, listen for the resourcetimingbufferfull event.

Syntax

js
setResourceTimingBufferSize(maxSize)

Parameters

maxSize

A number representing the maximum number of PerformanceEntry objects the browser should hold in its performance entry buffer.

Return value

None (undefined).

Examples

Setting a resource timing buffer size

The following call allows 500 "resource" performance entries in the browser's performance timeline.

js
performance.setResourceTimingBufferSize(500);

If you set the buffer size to a number lower than the amount of current entries in the buffer, no entries will be removed. Instead, to clear the buffer, call Performance.clearResourceTimings().

js
performance.getEntriesByType("resource").length; // 20
performance.setResourceTimingBufferSize(10);
performance.getEntriesByType("resource").length; // 20

performance.clearResourceTimings();
performance.getEntriesByType("resource").length; // 0

Specifications

Specification
Resource Timing
# dom-performance-setresourcetimingbuffersize

Browser compatibility

desktop mobile server
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Bun
Deno
Node.js
setResourceTimingBufferSize
Chrome – No support
Chrome 22 – 56 (Release date: 2012-09-25)
prefix
footnote Removed in 57 and later
prefix Implemented with the vendor prefix: webkit
Chrome – Full support
Chrome 46 (Release date: 2015-10-13)
footnote Full support
Edge – Full support
Edge 12 (Release date: 2015-07-29)
footnote Full support
Firefox – Full support
Firefox 35 (Release date: 2015-01-13)
footnote Full support
Opera – No support
Opera 15 – 43 (Release date: 2013-07-02)
prefix
footnote Removed in 44 and later
prefix Implemented with the vendor prefix: webkit
Opera – Full support
Opera 33 (Release date: 2015-10-27)
footnote Full support
Safari – Full support
Safari 11 (Release date: 2017-09-19)
footnote Full support
Chrome Android – No support
Chrome Android 25 – 56 (Release date: 2013-02-27)
prefix
footnote Removed in 57 and later
prefix Implemented with the vendor prefix: webkit
Chrome Android – Full support
Chrome Android 46 (Release date: 2015-10-14)
footnote Full support
Firefox for Android – Full support
Firefox for Android 35 (Release date: 2015-01-13)
footnote Full support
Opera Android – No support
Opera Android 14 – 42 (Release date: 2013-05-21)
prefix
footnote Removed in 43 and later
prefix Implemented with the vendor prefix: webkit
Opera Android – Full support
Opera Android 33 (Release date: 2015-11-03)
footnote Full support
Safari on iOS – Full support
Safari on iOS 11 (Release date: 2017-09-19)
footnote Full support
Samsung Internet – No support
Samsung Internet 1.5 – 6.4 (Release date: 2013-09-25)
prefix
footnote Removed in 7 and later
prefix Implemented with the vendor prefix: webkit
Samsung Internet – Full support
Samsung Internet 5 (Release date: 2016-12-15)
footnote Full support
WebView Android – No support
WebView Android 4.4 – 56 (Release date: 2013-12-09)
prefix
footnote Removed in 57 and later
prefix Implemented with the vendor prefix: webkit
WebView Android – Full support
WebView Android 46 (Release date: 2015-10-14)
footnote Full support
WebView on iOS – Full support
WebView on iOS 11 (Release date: 2017-09-19)
footnote Full support
Bun – Full support
Bun 1.1.37 (Release date: 2024-11-26)
footnote Full support
Deno – Full support
Deno 2.7 (Release date: 2026-02-25)
footnote Full support
Node.js – Full support
Node.js 18.8 (Release date: 2022-08-24)
footnote Full support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
Requires a vendor prefix or different name for use.
Has more compatibility info.

See also