# react-perf-utils

> wrapper for react/lib/ReactDefaultPerfAnalysis with utility functions for measuring component rendering performance and reporting

Latest version **1.0.0** (published 2017-06-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-perf-utils
pnpm add react-perf-utils
yarn add react-perf-utils
bun add react-perf-utils
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2017-06-12 |
| First published | 2016-01-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 7 |
| Author | Jason Strimpel |
| Maintainers | jstrimpel |
| Keywords | react, performance |

## Links

- npm: https://www.npmjs.com/package/react-perf-utils
- Repository: https://github.com/jstrimpel/react-perf-utils
- Homepage: https://github.com/jstrimpel/react-perf-utils#readme
- Issues: https://github.com/jstrimpel/react-perf-utils/issues
- npm.io page: https://npm.io/package/react-perf-utils

## Dependencies (4)

- [react](https://npm.io/package/react.md) ^15.5.4
- [react-dom](https://npm.io/package/react-dom.md) ^15.5.4
- [object-assign](https://npm.io/package/object-assign.md) ^4.1.1
- [react-addons-perf](https://npm.io/package/react-addons-perf.md) ^15.4.2

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2017-06-12
- 0.0.5 — 2016-02-17
- 0.0.4 — 2016-01-27
- 0.0.3 — 2016-01-26
- 0.0.2 — 2016-01-26
- 0.0.1 — 2016-01-26

## README

# react-perf-utils
A small library that provides access to the algorithms that are used for the pretty print
functions in [`react-addons-perf`](https://facebook.github.io/react/docs/perf.html)
and a handful of simple functions that can be used to measure against rendering performance
budgets when testing.

See [`react-addons-perf`](https://facebook.github.io/react/docs/perf.html) for more information on
how to collect measurements.

## API
See `react/lib/ReactDefaultPerfAnalysis.js` for more information on `getExclusiveSummary`,
`getInclusiveSummary`, `getDOMSummary`, and `getTotalTime`.

### Setup
All API examples assume that the following code has been executed:

```javascript
import ReactDOM from "react-dom";
import Perf from 'react-addons-perf';
import MyApp from './my-app';

// start -> render -> stop -> get measurements
Perf.start();
ReactDOM.render(<MyApp />, document.getElementById('root'));
Perf.stop();
```

### `getAvgRenderTime`
The average rendering time for all instances of a given component.

```javascript
const measurements = Perf.getLastMeasurements();
const avgRenderTime = PerfUtils.getAvgRenderTime('SomeCmpName', measurements);
```

### `getAvgMountTime`
The average mount time for all instances of a given component.

```javascript
const measurements = Perf.getLastMeasurements();
const avgMountTime = PerfUtils.getAvgMountTime('SomeCmpName', measurements);
```

### `getTotalRenderTime`
The total rendering time for all instances of a given component.

```javascript
const measurements = Perf.getLastMeasurements();
const totalRenderTime = PerfUtils.getTotalRenderTime('SomeCmpName', measurements);
```

### `getTotalMountTime`
The total mount time for all instances of a given component.

```javascript
const measurements = Perf.getLastMeasurements();
const totalMountTime = PerfUtils.getTotalMountTime('SomeCmpName', measurements);
```

---
_Source: https://npm.io/package/react-perf-utils · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
