Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JAVASCRIPTCORE_ENABLED compiling fails #486

Open
ekegulskiy opened this issue Jul 26, 2019 · 7 comments
Open

JAVASCRIPTCORE_ENABLED compiling fails #486

ekegulskiy opened this issue Jul 26, 2019 · 7 comments

Comments

@ekegulskiy
Copy link

Environment

Ubuntu 18, latest code from https://github.com/status-im/react-native-desktop

Description

I tried to enable JavaScriptCore feature with the following steps:

  1. CMAKE option -DJAVASCRIPTCORE_ENABLED=ON
  2. make

The 'make' command error-ed out failing to download webkit project needed for JavaScriptCore_ep. I was able to bypass this issue by fixing the GIT_REPOSITORY variable in CMakeList.txt:

ExternalProject_Add(JavaScriptCore_ep **GIT_REPOSITORY https://github.com/WebKit/webkit.git** GIT_TAG 06fcd5bda23a9f4844263b60b33f2ad83be4d871 BUILD_BYPRODUCTS ${JavaScriptCore_STATIC_LIB} CONFIGURE_COMMAND ${JavaScriptCore_PREFIX}/Tools/Scripts/build-webkit --jsc-only --cmakeargs="-DENABLE_STATIC_JSC=ON -DUSE_THIN_ARCHIVES=OFF" BUILD_COMMAND "" INSTALL_COMMAND "" )
After this fix, it succeed to download and compile JSC library. However, the next step in the make process (building ReactCommon folder) has failed with many compile errors.

Is this feature supported in react-native-desktop project?

Thank you,
Eduard.

@vkjr
Copy link
Contributor

vkjr commented Jul 29, 2019

@ekegulskiy, this feature hasn't been tested for a while, so it can be broken (

@ekegulskiy
Copy link
Author

Hi Volodymyr, thanks for quick response.

Just to explain, I am running react-native-desktop on embedded Linux device and am looking for ways to improve performance. In the current architecture, the JS execution happens in a separate process (nodejs) and is probably affecting performance. Using JAVASCRIPTCORE_ENABLED feature would move the JS execution to the QT rendering process and should improve rendering performance (e.g. animations or key response time). Is my understanding correct?

If you think it would be useful, I would love to contribute and help fix this feature, with some guidance/suggestions from you - please let me know. (BTW, is there a known changelist where the feature used to work?)

Thank you for your time,
Eduard.

@vkjr
Copy link
Contributor

vkjr commented Jul 29, 2019

Could you please try this PR? #450
It has js execution performed using internal qt js executor. Not merged yet, but had to be :)

Btw, I would be really glad to hear more about your project. So far I know only about usage of react-native-desktop in Status app. If you created some project with it, maybe commercial - that would make me happy :)

@ekegulskiy
Copy link
Author

Thanks Volodymyr.

I am working with the embedded device that is used to run HTML apps and play video. For running HTML apps, I am using webkit and want to explore other options that may give better performance. So, I was hoping that react-native-desktop would allow for more performant applications on embedded device (i.e. smoother animations, smaller footprint).

Thanks for sharing the PR, how do I build it? Do I still use -DJAVASCRIPTCORE_ENABLED=ON for the cmake command, or some other define?

@vkjr
Copy link
Contributor

vkjr commented Jul 30, 2019

You don't need to do special building of that PR. You can use it instead current version of react-native-desktop in your project. In this case you need to make change in desktop/main.cpp file and set new default executor:

ReactNativeProperties* rnp = new ReactNativeProperties(&view);
rnp->setExecutor("JSWebEngineExecutor"); // This is the line you need to add

@ekegulskiy
Copy link
Author

Thanks, I was able to run it on Ubuntu now. (BTW, just changing the desktop/main.cpp did not work - the d->jsExecutor variable was still set to "NodeJsExecutor" in Bridge::setupExecutor() function. Only after I changed the rootview.cpp to initialize jsExecutor to "JSWebEngineExecutor", it worked)

However, the option to use QTWebEngine is problematic for the embedded device because of large QTWebEngine size. On my device I already have WPE webkit engine with the JavaScriptCore library available. Do you think it will be easy to write a new JS executor based on JavaScriptCore from webkit?

In general, how is the JS execution is done on MacOS and Android? Does MacOS use JavaScriptCore available as part of Safari browser? (sorry to post generic questions here, is there a forum where I can ask generic questions?)

@vkjr
Copy link
Contributor

vkjr commented Aug 1, 2019

@ekegulskiy,

Do you think it will be easy to write a new JS executor based on JavaScriptCore from webkit?

To be honest, I don't know is it easy, because I didn't work with JavaScriptCore. Its test support was made by another developer who doesn't work on a project anymore.

Does MacOS use JavaScriptCore available as part of Safari browser?

On ios react-native uses JavaScriptCore engine provided by OS itself. In PR for macos it looks like javascriptcore taken from webkit repo and builds along with app.

On mobile devices during debugging used chrome V8 engine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants