Summary: This thread is effectively the "main thread" for JavaScript code in React Native applications, so it should have as high a quality-of-service as possible.
public
Reviewed By: javache, nicklockwood
Differential Revision: D2641878
fb-gh-sync-id: 3c60c1abeeab9e7405d6fc9602e0d4ccfab1ea1b
Summary: public
The WebView executor has no benefits compared to the JSC executor (slower, no extra debugging tools...),
and it's pretty hacky (since it injects the code in a script tag we have to check for tags in the comments and etc...).
Reviewed By: nicklockwood, javache
Differential Revision: D2636465
fb-gh-sync-id: 0d0f8a59e2c12fe7905b02060b3938c894d2802b
Summary: public
Rename it to `RCT_PROFILE_(BEGIN|END)_EVENT` to make it clearer that it's a macro,
since it has special behaviours.
Reviewed By: jspahrsummers
Differential Revision: D2631542
fb-gh-sync-id: 629c139462c4aa3582f719b14482017d13676e33
Summary: public
For "some" reason, exception is never `NULL`, it's `null` (the JavaScript value),
so the calls will never finish.
Reviewed By: javache
Differential Revision: D2625896
fb-gh-sync-id: fc8176a6ac485bfecc9903db05bf69b39ac2d9b4
Summary: public
Added lightweight genarics annotations to make the code more readable and help the compiler catch bugs.
Fixed some type bugs and improved bridge validation in a few places.
Reviewed By: javache
Differential Revision: D2600189
fb-gh-sync-id: f81e22f2cdc107bf8d0b15deec6d5b83aacc5b56
Summary: public
Expose a more precise timer, millisecond precision is enough to measure small operations.
Reviewed By: javache
Differential Revision: D2604218
fb-gh-sync-id: ba50c891b5690575548fe04ba1ae7d015bc31d90
Summary: public
We moved to using `new` instead of `alloc] init` but there was still some calls
left.
Reviewed By: javache
Differential Revision: D2604679
fb-gh-sync-id: ff7300ecbedb55dd5e93873592598810c9b87808
Summary: public
After reloading the JS side of the profiler wasn't being reenabled.
Reviewed By: javache
Differential Revision: D2602258
fb-gh-sync-id: 5de8afb829e9fa8225600e2b0ff9e00313ac1d4c
Summary: public
Implement the iOS side of the optmisation previously implemented in android
(D2485402)
Depends on D2540746
Reviewed By: javache
Differential Revision: D2541118
fb-gh-sync-id: f3590600a6defa2da75c5b7b2cced6ad8bfea6cb
Summary: The Obj-C API is usually easier to work with, and also makes it very easy to use the C API when necessary (performance, for example). This diff just switches the designated initializer of RCTContextExecutor to take a JSContext instead of JSGlobalContextRef, but the old initializer still works if needed.
I was doing some memory leak investigation and it is easier with ARC so I wanted to incrementally move the executor to Obj-C.
Closes https://github.com/facebook/react-native/pull/2159
Reviewed By: svcscm
Differential Revision: D2554890
Pulled By: tadeuzagallo
fb-gh-sync-id: 75b96d04cddff68fa3daf5d0fafdffad21dae307
Summary: public
Benchmarking our startup path has shown we spend a lot of time decoding strings (iPhone 4S / iPhone 5):
* reading a 2MB JS bundle: 35ms / 15ms
* decoding is to an `NSString`: 186ms / 78ms
* transforming that to a `JSString`: 29ms / 10ms
Instead of going through an `NSString` transformation, we generate a null-terminated bundle (0.1ms / 0.05ms to copy the data) and use `JSStringCreateWithUTF8CString` (121ms / 53ms) to generate the string. That makes decoding 70% faster.
Reviewed By: javache
Differential Revision: D2541140
fb-gh-sync-id: 09a016b8edfd46a9b62682c76705564d2024e75e
Summary: @public
Take a step back and de-batch the bridge calls so we can have better profiling data and a better starting point to work on future optimisations. Also gave a 10~15% win on first render.
Reviewed By: @javache
Differential Revision: D2493674
fb-gh-sync-id: 05165fdd00645bdf43e844bb0c4300a2f63e7038
Summary: @public
The RCTDevMenu always calls the handler, even with the state hasn't changed.
Guard against it.
Reviewed By: @javache
Differential Revision: D2499034
Summary: This API is defined only on iOS 8 and newer. There is a warning that the function is defined when checking if it exists since it is always defined in the iOS 8 SDK but not necessarily on iOS 7 phones. Use pragmas to silence the warning.
Closes https://github.com/facebook/react-native/pull/2475
Reviewed By: @trunkagent, @vjeux
Differential Revision: D2443432
Pulled By: @tadeuzagallo
Summary: @public
Using the saved state of the toggle button, this starts profiling automatically when the `RCTContextExecutor` is set up, if it was profiling before.
Reviewed By: @tadeuzagallo
Differential Revision: D2429026
Summary: @public
Migrate scripts to open source and add new route on the packager
to directly convert profiler outputs to a devtools compatible format.
Reviewed By: @jspahrsummers
Differential Revision: D2425740
Summary: @public
* Change the JSON generation and remove the dependency on YAJL since it had a
128 depth limit
* Enable the profiler bytecode generation to fix missing frames
* Save the output to a file on the tmp dir instead of outputting it to the console
Reviewed By: @jspahrsummers
Differential Revision: D2420754
Summary:
Fixes#2464
After the bridge parallelisation of the bridge initialisation the executors
were being `setUp` in a background thread, and the `RCTWebViewExecutor` was
crashing when creating a `UIWebView` out of the main thread.
Wrap the `UIWebView` creation in a call to the main thread.
Summary:
Add JSC profiler to the dev menu and rename the pre-existent one to systrace.
For now it just outputs to the console, but a better workflow is on the way.
Summary:
Our events all follow a common pattern, so there's no good reason why the configuration should be so verbose. This diff eliminates that redundancy, and gives us the freedom to simplify the underlying mechanism in future without further churning the call sites.
Summary:
Add a method that lets JS set the name of the JSContext for debugging purposes. I check `JSGlobalContextSetName` since it is not available on iOS 7.
Closes https://github.com/facebook/react-native/pull/2144
Github Author: James Ide <ide@jameside.com>
Summary:
`NSProcessInfo operatingSystemVersion` was being used to check the system version
for the Legacy Profiler on `RCTContextExecutor` but it's only available on iOS8+
Change it to `[UIDevice systemVersion]`
Summary:
The context wasn't being explicitly released before, since it'd be immediately
released. Now that the executors are bridge modules, it was only being deallocated
when the modules were released, what caused the threads to not be released at all.
Summary:
Remove `RCTGetExecutorID` and `RCTSetExecutorID`, it wasn't used anymore since
the bridge was refactored into `RCTBridge` and `RCTBatchedBridge`.
Summary:
The context wasn't being explicitly released before, since it'd be immediately
released. Now that the executors are bridge modules, it was only being deallocated
when the modules were released, what caused the threads to not be released at all.
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"
```
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.
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.
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.