Skip to content

Instantly share code, notes, and snippets.

View erikcohenGL's full-sized avatar

Erik Cohen erikcohenGL

View GitHub Profile
@TerribleDev
TerribleDev / createMarkedSelector.js
Last active July 16, 2021 14:53
Wrap reselect's createSelector with a function that measures how long selectors take to run
import {createSelector} from 'reselect';
const hasPerformanceApi =
window &&
window.performance &&
window.performance.measure &&
window.performance.mark;
const createFuncWithMark = (name, callback) => (...args) => {
const startMark = `${name}-Startmark`;