JS thread in react native is having low fps - performance

I am having significant JS thread frame drop(low fps), when I am running my react native app on android devices. It affects the responsiveness of the screen on devices with less RAM. Any suggestions(any tool or profiler) on how can I detect frame drops i.e. which component is causing frame drop?

https://reactnative.dev/docs/profiling is a good starting point.
The article references systrace, which is now integrated into the Android Studio CPU profiler. Just record a trace using the Trace System Calls configuration. The UI is similar to the legacy systrace tool but focuses on your app's process so it should make it easier to find the JS Thread. For how to use System Trace in Android Studio, please check out this video: https://youtu.be/EjmIit_amnE.

Related

Profiling OpenGL ES in Windows

I'm trying to do some profiling on my OpenGL ES code. Somewhere in my GPU pipeline (a shader I believe) is causing a huge delay. Which is the best profiler I can use? Is this one a good option? is there one I can use directly within Visual Studio?
If you have a GPU performance issue on IOS, the best is to use XCode tools to profile it directly on device, running the app from Xcode and then doing a frame capture to look at the timings for each draw call / the number of cycles used by each shader (more info here)
You can also profile on Windows if you are also able to simulate your graphics pipeline in classic OpenGL in your Windows version, but this may not be a good idea as the iPhone's GPU is very different than a classic desktop GPU so the bottleneck might not be the same on Windows than on IOS.
To profile on Windows I would suggest using either Nvidia PerfKit (if you have a Nvidia card) or AMD's GPU PerfStudio if you have an AMD card.
There is also RenderDoc which is a nice tool but not sure if it provides much profiling information (it is more for debugging graphics issues than profiling)

NativeScript limitations

I´m evaluating differents mobile frameworks, and I think that nativescript is a good option. But I don't know if exists limitations on the development process. For example I had limitations on the styling (and that's not so important), but I want to know if in the future I can have a limitation and can´t use some native feature or external library.
Thanks!
I have been using NativeScript since v0.90. I have written multiple apps and over 40 plugins for NativeScript, so I am very familiar with the ins and outs of the platforms.
This post is features as of v6.50.
I can think of only a couple limitations;
Tooling sometimes leaves a lot to be desired, however using the IDE's supported make this better than the Native CLI in a lot of cases.
Sometimes errors aren't always propagated back from the app to the screen/ide -- so you have to do things like "adb logcat" to see the full error log to see the error that got filtered out by the CLI.
Native Services (i.e. background services) --- This is much better written as native code. The NS runtimes take memory while running; so a service you typically want as small of a memory footprint as possible -- I would not use anything but Java/ObjC for a background service.
OpenGL on android needs to run in a separate thread, NS by default switches you back to the main thread when returning from any native calls; this basically kills direct NS opengl calls. However, it is actually better to create any OpenGL stuff in Java or Kotlin anyways; and then have NS call into your native code that handles all the rendering, so this is more of a minor annoyance.
Beyond that I can't think of any "real" limitations; you have full access to the native platform and can actually style any control as long as you know how to do it via native calls; if for some reason the control doesn't support the normal css styling. I & others have used many Android and iOS libraries in our apps. You can easily reuse native android/ios components you have full access to anything out there that is available to a native iOS or Android app.
You can look at https://plugins.nativescript.rocks for a list of all the plugins in the NativeScript community.
I have been developing with Nativescript for some time now, and while finished product (application) is more than decent, the process of development is really painful. The primary reason for that are frequent bugs in Nativescript platform itself, and it's official plugin for VSCode.
I am currently working on Nativescript 2.0.0 and have been trying to update to newer versions since they came out, but there were always some errors, ether with Node, or with Gradle for Android, and that is just one of many problem examples I face with the platform. I wish they improve it in the near future.
For now native apis are fully accessible from JS but if you want you can do some library in native languages and call them from JS code too, about external libraries it depends if you mean native libraries or JS ones, but there quite many options/plugins done in JS code using some native libraries but in case not as JS plugin you can do it yourself with native libraries
Community support is low compared to other frameworks available in the market. This should improve as people adopt the framework. I see that as a limitation for now.
And Yes, Debugging is indeed a limitation.
Nativescript is the best cross-platform solution in my opinion, but like the others stated there can be limitations. Besides background services, accessing the hardware CAN be a bit tricky. I have been using it to work with BLE devices though, and once you understand how to interact with native APIs, it isn't so bad.
I've written one NS app (core).
Some of the cons are:
performance - loading and also run-time. I'm replacing an Android native app with a NS app (because it's cross platform) and few customers have complained that the new app is slower and jerky...I agree.
bugs in NS core. I think that they've spreading themselves too thin. They need to get their core product stable and improve it (i.e. make it faster).
plug-ins varying quality with minimal support. Here NS could curate a few important plug-ins and make people pay for it.
Yes it's free - but that's not a huge issue for me - I'd prefer to pay for a more polished product.
At the end of the day - the product works - have my app in the app-store and look forward to future improvements.

Application Compilation using Graphics Card

During the Microsoft Windows 10 Devices event, Panos Panay - whilst talking about the Surface Books graphics said the following:
It's for that coder, using the latest Visual Studio where they can compile using the GPU and CPU at the same time and not lose a minute (Video)
This could just be a throwaway comment, but given that it is possible to do CPU type activities on the GPU (CUDA?), I wondered if he was actually talking about a genuine way to make Visual Studio use both the CPU and the GPU to perform application compilation.
Looking online, I can't see an obvious answer. Is this possible?
If they use something like AMP underneath then that is exactly what it is designed to do... use CPU and GPU (heterogeneous computing).

DirectX Performance in Windows8 App vs Desktop

Is there a performance difference between DirectX in a Win8 Desktop App versus DirectX in a Win8 (Store) App?
I am not interested in XAML.
Afaik the store apps use a run - suspend - end cycle so I suppose there could be a small performance loss through abstraction. Am I right with this assumption?
Or is there no noticeable difference?
There is some additional startup and shutdown delay due to the animations that occur automatically (fractions of a second). Once you're in your render loop though it should be equivalent performance - there's no extra abstraction for native app code.

Real-time Android application

I would like to build an Android app that process acceleration data and return result every 0.5 seconds. Are there any way to deal with the problem with out using native code?
P/s: I'm a newbie so please go easy on me!
Currently, there is no official support for real-time Java on Android.
But, there has been some research/academic projects focusing on bringing real-time capabilies into the Android world, you should check out:
RTDroid: A Design for Real-Time Android
Non-Blocking Garbage Collection for Real-Time Android

Resources