Performance

  • Revision slug: Web/API/Performance
  • Revision title: Performance
  • Revision id: 465637
  • Created:
  • Creator: teoli
  • Is current revision? No
  • Comment

Revision Content

The Performance interface represents timing related performance information for the given page.

An object of this type can be obtained by calling the {{domxref("Window.performance")}} read-only attribute.

Properties

The Performance interface doesn't inherit any property.

{{domxref("Performance.timing")}} {{readonlyInline}}
Is a {{domxref("PerformanceTiming")}} object containing latency-related performance information.
{{domxref("Performance.navigation")}} {{readonlyInline}}
Is a {{domxref("PerformanceNavigation")}} object representing the type of navigation that occurs in the given browsing context, like the amount of redirections needed to fetch the resource.

Methods

The Performance interface doesn't inherit any method.

{{domxref("Performance.now()")}}
Returns a {{domxref("DOMHighResTimeStamp")}} representing the amount of miliseconds elapsed since the start of the navigation, as give by {{domxref("PerformanceTiming.navigationStart")}} to the call of the method.
{{domxref("Performance.toJSON()")}} {{non-standard_inline}}
Is a jsonizer returning a json object representing the Performance object.

Specifications

Specification Status Comment
{{SpecName('Highres Time', '#sec-extenstions-performance-interface', 'Performance')}} {{Spec2('Highres Time')}} Added the now() method.
{{SpecName('Navigation Timing', '#sec-window.performance-attribute', 'Performance')}} {{Spec2('Navigation Timing')}} Initial definition.

Browser compatibility

{{CompatibilityTable}}
Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support (timing attribute) 6.0 {{CompatGeckoDesktop("7.0")}} 9.0 15.0 {{CompatNo}}
navigation attribute {{CompatNo}} {{CompatNo}} 9.0 {{CompatNo}} {{CompatNo}}
now() {{ CompatChrome("20.0") }} {{ property_prefix("webkit") }}
{{ CompatChrome("24.0") }}
{{ CompatGeckoDesktop("15.0") }} 10.0 {{CompatNo}} {{CompatNo}}
toJSON() {{non-standard_inline}} {{CompatNo}} {{CompatGeckoDesktop("25.0")}} 9.0 {{CompatNo}} {{CompatNo}}
Feature Android Firefox Mobile (Gecko) Firefox OS IE Phone Opera Mobile Safari Mobile
Basic support {{CompatNo}} {{CompatGeckoMobile("7.0")}} {{CompatGeckoFxOS("7.0")}} 9.0 15.0 {{CompatNo}}
navigation attribute {{CompatNo}} {{CompatNo}} {{CompatNo}} 9.0 {{CompatNo}} {{CompatNo}}
now() {{ CompatChrome("20.0") }} {{ property_prefix("webkit") }}
{{ CompatChrome("24.0") }}
{{ CompatGeckoDesktop("15.0") }} {{ CompatGeckoFxOS("15.0") }} 10.0 {{CompatNo}} {{CompatNo}}
toJSON() {{non-standard_inline}} {{CompatNo}} {{CompatGeckoMobile("25.0")}} {{CompatGeckoFxOS("25.0")}} 9.0 {{CompatNo}} {{CompatNo}}

See also

  • Related interfaces: {{domxref("PerformanceTiming")}}, {{domxref("PerformanceNavigation")}}.

Revision Source

<p>The <strong><code>Performance</code></strong> interface represents timing related performance information for the given page.</p>
<p>An object of this type can be obtained by calling the {{domxref("Window.performance")}} read-only attribute.</p>
<h2 id="Properties">Properties</h2>
<p><em>The <code>Performance</code> interface doesn't inherit any property.</em></p>
<dl>
  <dt>
    {{domxref("Performance.timing")}} {{readonlyInline}}</dt>
  <dd>
    Is a {{domxref("PerformanceTiming")}} object containing latency-related performance information.</dd>
  <dt>
    {{domxref("Performance.navigation")}} {{readonlyInline}}</dt>
  <dd>
    Is a {{domxref("PerformanceNavigation")}} object representing the type of navigation that occurs in the given browsing context, like the amount of redirections needed to fetch the resource.</dd>
</dl>
<h2 id="Methods">Methods</h2>
<p><em><em>The <code>Performance</code> interface doesn't inherit any </em>method</em>.</p>
<dl>
  <dt>
    {{domxref("Performance.now()")}}</dt>
  <dd>
    Returns a {{domxref("DOMHighResTimeStamp")}} representing the amount of miliseconds elapsed since the start of the navigation, as give by {{domxref("PerformanceTiming.navigationStart")}} to the call of the method.</dd>
  <dt>
    {{domxref("Performance.toJSON()")}} {{non-standard_inline}}</dt>
  <dd>
    Is a jsonizer returning a json object representing the <code>Performance</code> object.</dd>
</dl>
<h2 id="Specifications">Specifications</h2>
<table class="standard-table">
  <tbody>
    <tr>
      <th scope="col">Specification</th>
      <th scope="col">Status</th>
      <th scope="col">Comment</th>
    </tr>
    <tr>
      <td>{{SpecName('Highres Time', '#sec-extenstions-performance-interface', 'Performance')}}</td>
      <td>{{Spec2('Highres Time')}}</td>
      <td>Added the <code>now()</code> method.</td>
    </tr>
    <tr>
      <td>{{SpecName('Navigation Timing', '#sec-window.performance-attribute', 'Performance')}}</td>
      <td>{{Spec2('Navigation Timing')}}</td>
      <td>Initial definition.</td>
    </tr>
  </tbody>
</table>
<h2 id="Browser_compatibility">Browser compatibility</h2>
<div>
  {{CompatibilityTable}}</div>
<div id="compat-desktop">
  <table class="compat-table">
    <tbody>
      <tr>
        <th>Feature</th>
        <th>Chrome</th>
        <th>Firefox (Gecko)</th>
        <th>Internet Explorer</th>
        <th>Opera</th>
        <th>Safari (WebKit)</th>
      </tr>
      <tr>
        <td>Basic support (<code>timing </code>attribute)</td>
        <td>6.0</td>
        <td>{{CompatGeckoDesktop("7.0")}}</td>
        <td>9.0</td>
        <td>15.0</td>
        <td>{{CompatNo}}</td>
      </tr>
      <tr>
        <td><code>navigation</code> attribute</td>
        <td>{{CompatNo}}</td>
        <td>{{CompatNo}}</td>
        <td>9.0</td>
        <td>{{CompatNo}}</td>
        <td>{{CompatNo}}</td>
      </tr>
      <tr>
        <td><code>now()</code></td>
        <td>{{ CompatChrome("20.0") }} {{ property_prefix("webkit") }}<br />
          {{ CompatChrome("24.0") }}</td>
        <td>{{ CompatGeckoDesktop("15.0") }}</td>
        <td>10.0</td>
        <td>{{CompatNo}}</td>
        <td>{{CompatNo}}</td>
      </tr>
      <tr>
        <td><code>toJSON()</code> {{non-standard_inline}}</td>
        <td>{{CompatNo}}</td>
        <td>{{CompatGeckoDesktop("25.0")}}</td>
        <td>9.0</td>
        <td>{{CompatNo}}</td>
        <td>{{CompatNo}}</td>
      </tr>
    </tbody>
  </table>
</div>
<div id="compat-mobile">
  <table class="compat-table">
    <tbody>
      <tr>
        <th>Feature</th>
        <th>Android</th>
        <th>Firefox Mobile (Gecko)</th>
        <th><strong>Firefox OS</strong></th>
        <th>IE Phone</th>
        <th>Opera Mobile</th>
        <th>Safari Mobile</th>
      </tr>
      <tr>
        <td>Basic support</td>
        <td>{{CompatNo}}</td>
        <td>{{CompatGeckoMobile("7.0")}}</td>
        <td>{{CompatGeckoFxOS("7.0")}}</td>
        <td>9.0</td>
        <td>15.0</td>
        <td>{{CompatNo}}</td>
      </tr>
      <tr>
        <td><code>navigation</code> attribute</td>
        <td>{{CompatNo}}</td>
        <td>{{CompatNo}}</td>
        <td>{{CompatNo}}</td>
        <td>9.0</td>
        <td>{{CompatNo}}</td>
        <td>{{CompatNo}}</td>
      </tr>
      <tr>
        <td><code>now()</code></td>
        <td>{{ CompatChrome("20.0") }} {{ property_prefix("webkit") }}<br />
          {{ CompatChrome("24.0") }}</td>
        <td>{{ CompatGeckoDesktop("15.0") }}</td>
        <td>{{ CompatGeckoFxOS("15.0") }}</td>
        <td>10.0</td>
        <td>{{CompatNo}}</td>
        <td>{{CompatNo}}</td>
      </tr>
      <tr>
        <td><code>toJSON()</code> {{non-standard_inline}}</td>
        <td>{{CompatNo}}</td>
        <td>{{CompatGeckoMobile("25.0")}}</td>
        <td>{{CompatGeckoFxOS("25.0")}}</td>
        <td>9.0</td>
        <td>{{CompatNo}}</td>
        <td>{{CompatNo}}</td>
      </tr>
    </tbody>
  </table>
</div>
<h2 id="See_also">See also</h2>
<ul>
  <li>Related interfaces: {{domxref("PerformanceTiming")}}, {{domxref("PerformanceNavigation")}}.</li>
</ul>
Revert to this revision