Measure Render Performance

You can measure the render performance of your components with Polaris. Let's look at an example.

React
export function Grid() {
  const instrument = useInstrument('grid-sort');

  const handleSortClick = useCallback(async () => {
    // measure render time
    try {
      instrument.start();
      await sort();
      requestAnimationFrame(() => instrument.done());
    } catch (error) {
      instrument.fail(error);
    }
  }, []);

  return (<></>);
}