2017-05-25 22:09:55 +10: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.
|
|
|
|
//
|
|
|
|
|
|
|
|
let marky;
|
|
|
|
|
|
|
|
if (process.env.NODE_ENV === 'development') {
|
2017-05-26 02:59:18 +10: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);
|
|
|
|
}
|
2017-05-25 22:09:55 +10:00
|
|
|
marky = require('marky');
|
2017-05-26 05:14:40 +10:00
|
|
|
// allows us to easily do e.g. ReactPerf.printWasted() while debugging
|
2017-09-30 12:29:56 +10:00
|
|
|
//window.ReactPerf = require('react-addons-perf');
|
|
|
|
//window.ReactPerf.start();
|
2017-05-25 22:09:55 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
export function start(name) {
|
|
|
|
if (process.env.NODE_ENV === 'development') {
|
|
|
|
marky.mark(name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export function stop(name) {
|
|
|
|
if (process.env.NODE_ENV === 'development') {
|
|
|
|
marky.stop(name);
|
|
|
|
}
|
|
|
|
}
|