2017-05-25 08:09:55 -04:00
|
|
|
//
|
|
|
|
// Tools for performance debugging, only enabled in development mode.
|
|
|
|
// Open up Chrome Dev Tools, then Timeline, then User Timing to see output.
|
|
|
|
// Also see config/webpack/loaders/mark.js for the webpack loader marks.
|
|
|
|
|
2023-05-08 21:08:47 -04:00
|
|
|
import * as marky from 'marky';
|
2017-05-25 08:09:55 -04:00
|
|
|
|
2023-10-31 12:05:44 -04:00
|
|
|
import { isDevelopment } from './utils/environment';
|
|
|
|
|
|
|
|
if (isDevelopment()) {
|
2017-05-25 12:59:18 -04:00
|
|
|
if (typeof performance !== 'undefined' && performance.setResourceTimingBufferSize) {
|
|
|
|
// Increase Firefox's performance entry limit; otherwise it's capped to 150.
|
|
|
|
// See: https://bugzilla.mozilla.org/show_bug.cgi?id=1331135
|
|
|
|
performance.setResourceTimingBufferSize(Infinity);
|
|
|
|
}
|
2023-04-03 06:41:10 -04:00
|
|
|
|
2017-05-25 15:14:40 -04:00
|
|
|
// allows us to easily do e.g. ReactPerf.printWasted() while debugging
|
2017-09-29 22:29:56 -04:00
|
|
|
//window.ReactPerf = require('react-addons-perf');
|
|
|
|
//window.ReactPerf.start();
|
2017-05-25 08:09:55 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
export function start(name) {
|
2023-10-31 12:05:44 -04:00
|
|
|
if (isDevelopment()) {
|
2017-05-25 08:09:55 -04:00
|
|
|
marky.mark(name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export function stop(name) {
|
2023-10-31 12:05:44 -04:00
|
|
|
if (isDevelopment()) {
|
2017-05-25 08:09:55 -04:00
|
|
|
marky.stop(name);
|
|
|
|
}
|
|
|
|
}
|