Skip to content

Instantly share code, notes, and snippets.

@Antoinebr
Last active June 18, 2020 15:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Antoinebr/f6e964ba45a8cb4a3b369b9dfb11a27a to your computer and use it in GitHub Desktop.
Save Antoinebr/f6e964ba45a8cb4a3b369b9dfb11a27a to your computer and use it in GitHub Desktop.
use performance object to get insights

Use the performance object to monitor RUM

    const sleep = () => new Promise( (resolve, reject) => setTimeout( () => resolve(), 100 ));

    const init = async () => {
      performance.mark('One');

      await sleep();

      performance.mark('Two');

      await sleep();

      performance.mark('Three');

      await sleep();

      performance.mark('Four');

    }


     init().then( () => {

      performance.measure('🐪 Outer 🐪', 'One', 'Four');

      performance.measure('🐪 Inner 🐪', 'Two', 'Three');

     });

This will create marks inside timings

performance.mark will surface on various tools

PSI

LightHouse

WebpageTest ( test result -> details )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment