Hermes, V8, and Chakra has limited switching mechanisms
You should be able to have USE_HERMES and USE_v8 turned on, and just control which engine you want via InstanceSettings() or something. It looks like deeper down there is some flags/overrides but they aren't currently plumbed up all the way.
Also, USE_V8 is always turned on if its not ARM.
So if don't want to bubble up a code based switch and instead use the property macro, then it shouldn't automatically turn on USE_V8 as it currently does.
While USE_HERMES can be controlled via modifying react.cpp.props I wasn't ever able to get it turned on via modifying my own projects properties, so thats why a code based settings would be better.
From what I understand, the two mechanisms are separate. The code based switch is what we want consumers to use long term. I believe this exists for win32 right now, but am unfamiliar with the current state in the uwp world.
The pre-processor macros was intended for the developers of the platform and changes the build to produce dlls with V8/Hermes capabilities. (For example, many JSI related files are duplicated in three different places: the react-native npm package, the V8 nuget, and the Hermes nuget. USE_V8 and USE_HERMES changes which set of files we reference when building.)
@tudorms recently just made V8 ready for public consumption and changed the builds so that USE_V8 is set to true by default. Hermes is still months away from this, which is why USE_HERMES is set to false in React.cpp.props.
@tudorms, please correct me if anything I added here seems wrong.
Ah so is the recommendation to not use hermes, but instead to use v8 in the short term?
We'd like to move off chakracore with minimal effort so we can support arm64 and either hermes or v8 would be fine with us.
I would answer yes to your question, especially if what you are working on is a shipping Microsoft product. V8 is much closer to being production ready than Hermes, but last time I heard it's still a work-in-progress. @tudorms would have better context on the state of V8.
oh ok. Thanks. I wasnt sure what the long term design choice was here.
It looked like there was a switchable enum that wasn't being used so I had thought the goal was for easier switching. I think then I will change over my other PR to add a distinction between USE_V8 and ENABLE_V8 since there isn't any way for me to consume it as far as I can tell.
I think I will close this issue then.
FWIW, middle-term we'll probably get rid of the defines and use the enums to enable runtime selection of engine. I think we're most of the way there today already (you should be able to choose your JSI engine via an enum setting in both uwp and win32), the caveat is that we only build V8JSI for x86 and x64 today (as it's mostly intended for win32 use).
If you happen to choose V8 in other architectures it should gracefully fall-through to chakra (the only JSI engine which is somewhat supported across architectures).
Short-term there may be some confusion while we bring Hermes online and start phasing out the defines.
Long-term we'd probably pick a default and have a plug-in model for external engine selection where needed.
We need to support arm and arm64. And when we asked about some ChakraCore. I got the impression it wasn't really the path forward. "I’m a little surprised there’s a need for ChakraCore. It’s not the path forward now that we’ve moved to Chromium." It appears deprecated and not having any more resources allocated to it.
From what I can gather V8 isn't for arm/arm64. So that leaves us with Hermes which seems to support all platforms. And we are prepping to start shipping to rest of MS in the coming weeks and start expanding our audience rapidly.
Also we are interested in the small perf wins of either v8 or hermes over regular Chakra.
There's a lot of active discussion on how we can phase out Chakra, since you're totally right in that we don't want to support in long-term. I would agree with the assessment that V8 is further along in these efforts. There are still some open questions around its use on UWP though, which we just haven't looked into yet.