Commit Graph

41 Commits

Author SHA1 Message Date
Tadeu Zagallo 080d3b9f62 [ReactNative] Add PerformanceLogger to measure TTI
Summary:
@public

Add PerformanceLogger to keep track of JS download, initial script execution and
full TTI.

Test Plan:
The Native side currently calls `addTimespans` when it's finish initializing
with the six values (start and end for the three events), so I just checked it
with a `PerformanceLogger.logTimespans()` at the end of the function.

```
2015-06-18 16:47:19.096 [info][tid:com.facebook.React.JavaScript] "ScriptDownload: 48ms"
2015-06-18 16:47:19.096 [info][tid:com.facebook.React.JavaScript] "ScriptExecution: 106ms"
2015-06-18 16:47:19.096 [info][tid:com.facebook.React.JavaScript] "TTI: 293ms"
```
2015-06-19 15:01:35 -08:00
Tadeu Zagallo d3065fc2e7 [ReactNative] Remove RCT_IMPORT_METHOD macro and generate lookup table dynamically
Summary:
@public

This removes the last piece of data that was still stored on the DATA section,
`RCT_IMPORT_METHOD`. JS calls now dynamically populate a lookup table simultaneously
on JS and Native, instead of creating  a mapping at load time.

Test Plan: Everything still runs, tests are green.
2015-06-15 13:05:52 -08:00
Tadeu Zagallo 86dc92d5ab [ReactNative] Add ReactPerf info to profiler timeline
Summary:
@public

Hook into ReactPerf to add markers to `RCTProfile` timeline.

Test Plan: {F22569628}
2015-06-15 13:04:25 -08:00
Nick Lockwood 650fc9de4c Increased warning levels to -Wall -Wextra, and fixed Xcode 7 beta issues
Summary:
@public

I've increased the warning levels in the OSS frameworks, which caught a bunch of minor issues. I also fixed some new errors in Xcode 7 relating to designated initializers and TLS security.

Test Plan:
* Test the sample apps and make sure they still work.
* Run tests.
2015-06-15 07:52:50 -08:00
Tadeu Zagallo efd386eba2 [ReactNative] Fix timers for debugger executors
Summary:
@public

`-[RCTJavaScriptExecutor executeBlockOnJavaScriptQueue:]` would always `dispatch_async`
for the WebView and WebSocket executors, what caused for any frame aligned dispatch.

Test Plan:
Test the `Timers, TimerMixin` example on UIExplorer, `requestAnimationFrame` was
taking ~33.3ms when debugging, now takes ~16.6ms as expected.
2015-06-12 16:59:19 -08:00
Tadeu Zagallo 2a7adfb815 [ReactNative] Use RCTNullIfNill and (id)kCFNull
Summary:
@public

Use consistent `null` handling:

`value || null`                ->  `RCTNullIfNil(value)`
`value == null ? nil : value`  ->  `RCTNilIfNull(value)`
`[NSNull null]`                ->  `(id)kCFNull`

Test Plan: The tests should be enough.
2015-06-12 11:03:10 -08:00
Tadeu Zagallo 696b31f1a4 [ReactNative] Fix memory leak in RCTContextExecutor
Summary:
@public

Remove extra `JSGlobalContextRetain` that was causing the context ref to leak +
remove `self` reference from block and improve invalidation

Test Plan:
Run the UIExplorer, reload the app a few times, verify that the memory usage is
not increasing.
2015-06-12 10:59:48 -08:00
Tadeu Zagallo 847dff8d75 [ReactNative] Make JavaScript executors bridge modules
Summary:
@public

This is the first of a few diffs that change the way the executors are handled
by the bridge.

For they are just promoted to modules, so they are automatically loaded by the bridge.

Test Plan:
Tested on UIExplorer, Catalyst and MAdMan.
Tested all the 3 executors, everything looks fine.
2015-06-09 15:40:55 -08:00
Tadeu Zagallo 0f16d15d64 [ReactNative] Optimize console.profile and add markers on JS entry points
Summary:
@public

Right now the profiler shows how long the executor took on JS but doesn't show
how long each of the batched calls took, this adds a *very* high level view of JS
execution (still doesn't show properly calls dispatched with setImmediate)

Also added a global property on JS to avoid trips to Native when profiling is
disabled.

Test Plan:
Run the Profiler on any app

{F22491690}
2015-06-02 06:22:49 -08:00
Tadeu Zagallo 1c692e2eb6 [ReactNative] Use JSValueIsUndefined instead of comparing with JSValueMakeUndefined
Summary:
@public

Use JSValueIsUndefined instead of caching an JSValueMakeUndefined to compare with
as suggested in https://github.com/facebook/react-native/pull/1432#commitcomment-11437434

Test Plan: Run the RCTContextExecutor tests
2015-05-30 13:32:11 -08:00
Nick Lockwood 03889780b9 [WIP] Added loadingView property to RCTRootView 2015-05-28 13:20:46 -08:00
Nick Lockwood 455281e44d Fixed crash in RCTContextExecutor when requireJSRef == undefined 2015-05-27 08:50:03 -08:00
Robert Payne c91e2eb567 Use JSC C API for better invocation speed
Summary:
This converts the existing JSEvaluateScript call for `require('<ModuleName>').<MethodName>.apply(null, <args>);` to native JSC C API methods which shaves off about 10-15% of invocation time on average, I used pretty primitive profiling methods to track the minimum, maximum and average invocation time so would appreciate any extra eyes on the performance.

If the argument count is zero the method is invoked directly with no arguments, if the argument count is 1 it's invoked directly with just that argument. If there is more than 1 argument then apply is used and the arguments are passed as the second parameter.

Ensured all existing tests pass and instruments leaks shows nothing is leaking.
Closes https://github.com/facebook/react-native/pull/1037
Github Author: Robert Payne <robertpayne@me.com>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
2015-05-22 19:37:18 -08:00
Tadeu Zagallo e467fb7202 [ReactNative] Add console.profile hooks to systrace
Summary:
Add console.profile sync hooks compliant with the chrome API
https://developer.chrome.com/devtools/docs/console-api#consoleprofilelabel

@public

Test Plan:
Add a `console.profile()` and a `console.profileEnd()` in the JavaScript,
and record a systrace-like profile via DevMenu
2015-05-14 15:59:20 -08:00
Tadeu Zagallo 8d83b7ff63 [ReactNative] RCTWebViewExecutor - Fix string containing script tag support 2015-05-06 17:08:33 -08:00
Tadeu Zagallo 67196b36bb [ReactNative] Fix WebView executor 2015-05-01 06:11:36 -08:00
Tadeu Zagallo 2f4430cf51 [ReactNative] Fix bridge event dedupe 2015-04-28 07:58:35 -08:00
Tadeu Zagallo 8aeb33d44c [ReactNative] Make so each RCTContextExecutor has its own thread 2015-04-27 03:46:27 -08:00
Tadeu Zagallo dd6bce78e1 [ReactNative] Allow bridge modules to run on the JavaScript thread 2015-04-25 19:29:00 -08:00
Tadeu Zagallo bd5736414a [ReactNative] Fix error when reload during profile 2015-04-25 13:23:09 -08:00
Spencer Ahrens 1cc0c96508 [React Native] Bring back console.error redboxes with disable flag 2015-04-24 17:54:16 -08:00
Philipp von Weitershausen e88ba1a6a3 [ReactNative] Back out D2014163 entirely 2015-04-23 12:02:47 -08:00
Jakub Zika e293efbfb1 Bump .buckversion to 6cdb82cb7493a86c39d0f0dc3c102d0f470f55de. 2015-04-23 08:24:08 -08:00
Spencer Ahrens e63bfae8f6 [ReactNative] console.error shows RedBox with pretty stack trace 2015-04-22 15:51:41 -08:00
Nick Lockwood ee898c24c7 Removed debug code from release builds 2015-04-21 09:47:21 -08:00
Nick Lockwood 8e15a0d5e7 Added RCT_DEBUG 2015-04-21 05:24:10 -08:00
Tadeu Zagallo 915925db9d [ReactNative] Add tests on root view, bridge, modules and js context deallocation 2015-04-20 05:40:52 -08:00
Tadeu Zagallo fb1fa12e89 [ReactNative] Better profiling API + Fix overlaping events 2015-04-20 04:57:28 -08:00
Tadeu Zagallo 0e67e33534 [ReactNative] Ensure JS calls scheduled by a deallocated context don't fire 2015-04-20 02:03:22 -08:00
Nick Lockwood 0b21df4a34 Improved logging and dev menu 2015-04-19 12:56:22 -08:00
Tadeu Zagallo 50c9c616fb [ReactNative] Call invalidate when executor is deallocated 2015-04-16 08:45:42 -08:00
Alex Kotliarskyi b8d44d3f36 [ReactNative] Fix logging 2015-04-13 12:51:20 -08:00
Nick Lockwood 26fd24dc50 Cleanup 2015-04-11 14:19:49 -08:00
Tadeu Zagallo f5f80da80c [ReactNative] Remove bridge retaining cycles 2015-04-10 07:20:37 -08:00
Ben Hiller 220e116dce [fbobjc] revert rFBOBJCdba3daf9a595f452d069f2a74a9a11f251999b2e 2015-04-07 20:44:11 -08:00
Tadeu Zagallo 6854da9b86 [ReactNative] Remove bridge retaining cycles 2015-04-07 19:42:46 -08:00
Tadeu Zagallo 72390239be [ReactNative] Fix and re-add WebView executor 2015-04-07 18:25:38 -08:00
Nick Lockwood 80cd687e95 Refactored RCTLog and added facility to prepend extra data to the log message 2015-04-07 07:35:57 -08:00
Tadeu Zagallo f370f9cbc4 [ReactNative] Unfork RKRootView 2015-04-02 07:12:42 -08:00
Alex Akers 7a97043a3e [React Kit] Remove embarrassing TODOs 2015-03-26 10:33:05 -08:00
Tadeu Zagallo 20291a02df [ReactNative] s/ReactKit/React/g 2015-03-26 02:42:24 -08:00