All Projects → oslabs-beta → React Pinpoint

oslabs-beta / React Pinpoint

Licence: mit
An open source utility library for measuring React component render times.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to React Pinpoint

Myperf4j
High performance Java APM. Powered by ASM. Try it. Test it. If you feel its better, use it.
Stars: ✭ 2,281 (+2352.69%)
Mutual labels:  performance, performance-metrics, performance-visualization
Junitperf
⛵️Junit performance rely on junit5 and jdk8+.(java 性能测试框架)
Stars: ✭ 86 (-7.53%)
Mutual labels:  performance, performance-metrics, test
Sparklens
Qubole Sparklens tool for performance tuning Apache Spark
Stars: ✭ 345 (+270.97%)
Mutual labels:  performance, performance-metrics, performance-visualization
Should Enzyme
Useful functions for testing React Components with Enzyme.
Stars: ✭ 41 (-55.91%)
Mutual labels:  test, react-components
Browser Perf
Performance Metrics for Web Browsers
Stars: ✭ 930 (+900%)
Mutual labels:  performance, performance-metrics
Cmonoptus
Why am I not getting what I pay for?
Stars: ✭ 35 (-62.37%)
Mutual labels:  speed, test
Inspectit
inspectIT is the leading Open Source APM (Application Performance Management) tool for analyzing your Java (EE) applications.
Stars: ✭ 513 (+451.61%)
Mutual labels:  performance, performance-metrics
Observer cli
Visualize Erlang/Elixir Nodes On The Command Line
Stars: ✭ 1,058 (+1037.63%)
Mutual labels:  performance, performance-visualization
Import Cost
displays the import size of the package you are importing inside the code editor
Stars: ✭ 1,021 (+997.85%)
Mutual labels:  performance, performance-visualization
Tib
Easy e2e browser testing in Node
Stars: ✭ 64 (-31.18%)
Mutual labels:  test, puppeteer
Open Bank Mark
A bank simulation application using mainly Clojure, which can be used to end-to-end test and show some graphs.
Stars: ✭ 81 (-12.9%)
Mutual labels:  performance-visualization, docker-compose
Webdriverio
Next-gen browser and mobile automation test framework for Node.js
Stars: ✭ 7,214 (+7656.99%)
Mutual labels:  performance, test
Ngx Quicklink
Quicklink prefetching strategy for the Angular router
Stars: ✭ 586 (+530.11%)
Mutual labels:  performance, speed
Performance Bookmarklet
Performance-Bookmarklet helps to analyze the current page through the Resource Timing API, Navigation Timing API and User-Timing - requests by type, domain, load times, marks and more. Sort of a light live WebPageTest.
Stars: ✭ 997 (+972.04%)
Mutual labels:  performance, performance-metrics
Bloom
🌸 HTTP REST API caching middleware, to be used between load balancers and REST API workers.
Stars: ✭ 553 (+494.62%)
Mutual labels:  performance, speed
Performance Improvements For Woocommerce
Performance tweaks for the front-end and back-end of a store.
Stars: ✭ 46 (-50.54%)
Mutual labels:  performance, speed
Pcm
Processor Counter Monitor
Stars: ✭ 1,240 (+1233.33%)
Mutual labels:  performance-metrics, performance-visualization
Quicklink
⚡️Faster subsequent page-loads by prefetching in-viewport links during idle time
Stars: ✭ 9,176 (+9766.67%)
Mutual labels:  performance, speed
React Virtualized
React components for efficiently rendering large lists and tabular data
Stars: ✭ 22,963 (+24591.4%)
Mutual labels:  performance, react-components
Watchdoginspector
Shows your current framerate (fps) in the status bar of your iOS app
Stars: ✭ 497 (+434.41%)
Mutual labels:  performance, performance-visualization

React Pinpoint

An open source utility library for measuring React component render times.

Build Status

Table of Contents

Prerequisites

Browser context

React pinpoint must run inside a browser context to observe the React fiber tree. We recommended using automation software such as puppeteer to achieve this.

Production build with a twist

React optimises your development code base when you build for production, which decreases component render times. Users should therefore run react pinpoint against their production code

However, tweaks need to be made to the build process to preserve component names and enable render time profiling. Steps for doing so can be found here.

APIs

record(page, url, rootId)

  • page <Page> Puppeteeer page instance
  • url <string> address React page is hosted at
  • rootId <string> id of dom element that React is mounted to
  • returns: <Page> Puppeteeer page instance with a listener attached to React components

This function attaches a listener to the Puppeteer page's react root for recording changes

report(page, threshold)

  • page <Page> Puppeteeer page instance with record listener attached
  • threshold <Number> cutoff for acceptable component render time (in ms)
    • default time is 16ms
  • returns: Node[] An array of nodes belonging to each react component that exceeded the given render time threshold

Will report all component render times that exceed the given threshold in ms

If no threshold is given, the default threshold of 16ms is used (please see FAQ “Why is the default render threshold 16ms?”)

Examples

Using with Puppeteer

const puppeteer = require('puppeteer');
const reactPinpoint = require('react-pinpoint');

(async () => {
  const browser = await puppeteer.launch({});
  const page = await browser.newPage();

  // Pass information to
  const url = 'http://localhost:3000/calculator';
  const rootId = '#root';
  await reactPinpoint.record(page, url, rootId);

  // Perform browser actions
  await page.click('#yeah1');
  await page.click('#yeah2');
  await page.click('#yeah3');

  // Get all components that took longer than 16ms to render during browser actions
  const threshold = 16;
  const slowRenders = await reactPinpoint.reportTestResults(page, threshold);

  await browser.close();
})();

Getting Started

  1. Head over to the React Pinpoint website.
  2. Register for an account.
  3. Add a project and fill in the details.
  4. Copy the project ID provided.

Installation

Using npm:

npm install -D react-pinpoint

Using yarn:

yarn add react-pinpoint -D
  • Invoke mountToReactRoot and paste the project ID you received from the website as the second argument in your React project’s entry file:
mountToReactRoot(rootDom, projectID);
  • Interact with your app and data will be sent to React Pinpoint website.
  • Refresh the page and see your data displayed!

Docker

React pinpoint was designed with the goal of regression testing component render times within a CICD, we therefore offer several preconfigured docker containers to assist with using React pinpoint within a CICD as well as with examples for doing so.

FAQs

Why does React Pinpoint only measure individual component render times?

Since React has moved to using a React Fiber infrastructure, different component types are assumed to generate different trees.

Why is the default render threshold 16ms?

The recommended render time is 60 FPS.

Does React pinpoint work in a headless browser?

Yes! Due to the component render times being driven by component logic, a GUI is not needed to capture them.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].