add more infos on how to profile the javascript #10944

Summary:
As said in #10944, there's not yet some good infos on how to profile the javascript.

I'm adding a mention to two ways of doing it (`react-addons-perf` and chrome profiler), feel free to correct me on this.

I almost added an example for `react-addons-perf` but I'm not sure what's the correct way to use. Here's the way I use it:

```javascript
import Perf from 'react-addons-perf';

....
    componentDidMount() {
        console.log('start perf tracking');
        Perf.start();
        setTimeout(() => {
            console.log('stop perf tracking');
            Perf.stop();
            Perf.printExclusive();
        }, 10000);
   }
...
```
Closes https://github.com/facebook/react-native/pull/10974

Differential Revision: D4221630

Pulled By: mkonicek

fbshipit-source-id: 918f837b9c7169c3dd835e653c78159b801fb946
This commit is contained in:
Martin Konicek 2016-11-22 12:08:11 -08:00 committed by Facebook Github Bot
parent c609aee733
commit c038a3839a
1 changed files with 4 additions and 0 deletions

View File

@ -324,3 +324,7 @@ the JavaScript thread and main thread side-by-side.
For iOS, Instruments are an invaluable tool, and on Android you should
learn to use systrace.
You can also use [`react-addons-perf`](https://facebook.github.io/react/docs/perf.html) to get insights into where React is spending time when rendering your components.
Another way to profile JavaScript is to use the Chrome profiler while debugging. This won't give you accurate results as the code is running in Chrome but will give you a general idea of where bottlenecks might be.