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.
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.
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.
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}
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.