7 ms·
Hermes, a JavaScript engine optimized for React Native
- dizzy3gg 6y agoFrom the docs: "Hermes is an open-source JavaScript engine optimized for running React Native apps on Android." Looks like it's available for iOS now too :) Announcing React Native 0.64 with Hermes on iOS https://reactnative.dev/blog/2021/03/12/version-0.64 https://reactnative.dev/blog/2021/03/12/version-0.64
- dgellow 6y agoAnd with "React Native for Windows" and "React Native for macOS" (both are still experimental): https://microsoft.github.io/react-native-windows/docs/hermes https://microsoft.github.io/react-native-windows/docs/hermes
- mirekrusin 6y agoMicrosoft just gain a ton of respect by putting it out, upfront description etc, I’m impressed by collaboration and plain statements.
- pjmlp 6y agoAnd on Windows it uses WinUI/UWP actually. The recent XBox dashboard has been remade with it.
- dgellow 6y agoOn Windows native components can be in C++/WinRT or C#, which is quite nice. Typescript for the glue, managed C++ for the heavy lifting. That's a great compromise IMHO, at least in theory. I'm still a bit skeptical because I haven't seen yet WinUI or UWP applications with a passable user experience.
- pjmlp 6y agoAgreed, you can see how I have been an heavy advocate of it, and see it not only as a much better COM, but also what .NET v1.0 should have been (it was the original idea anyway, Ext-VOS). However nowadays I have become quite sceptical on what it will ever be, and looking forward to what news BUILD 2021 might bring. C++/WinRT tooling still doesn't match C++/CX, doing UI in .NET or ReactNative (QML style) seems to be the workaround for it, endless list of Github issues on WinUI, Reunion and all WinRT bindings, community talks with lots of previews, and state of current tooling. Then the various UI teams seem to be competing to which of them will get more developer mindshare. So it is a mess, that I hope BUILD will get a more clear picture.
- Cullinet 6y agototally understand that kind of pain : actively thinking about writing driver primitives to shim into the ui library layers to get the eventual sensibility we need. I've spent a inordinate amount of time on figuring out how to hire a truly dedicated windows native interface team and the only solid conclusion that I've come to is it's necessary to also recruit to write tooling for the designers to work with. we have a application that happily doesn't need a gui but to be used widely needs a excellent gui. it looks like we'll need at least as many people on interface as for our core application. the tooling, oh the tooling..
- Cullinet 6y agoWoz dug the windows phone in the earlier lumia stages prior to the wp8 NT kernel with everything else gutting. this is the one book I most want for Christmas - the true account of what happened to the windows phone interface. I was constantly in awe to behold the developments as they happened ; literally "too good to be true" electrocuted me in my chair every time I read the latest.
- kabes 6y agoYeah. Never thought I'd read how to use a facebook javascript engine for macOS on a microsoft site.
- jbverschoor 6y agoWhy not? Microsoft and Facebook have been lovers since the beginning.. Even in terms of UI design of the earliest of facebook.
- WorldMaker 6y agoAlso, Microsoft has a long history of being one of the largest software developers for macOS. Even when deep in the worst Windows versus Mac OS competitive years, Microsoft still shipped a lot of software to Mac OS. (Most of it Office products.)
- madeofpalk 6y agoInteresting - I would have thought custom JS engines/runtimes would be a no go for both iOS and the iOS App Store.
- lucideer 6y agoDefinitely fine for Android (there's plenty of them), but I would've thought the same for iOS. Now that I think of it though, I think the Apple ToS that prohibit browsers are about function (app used to browse the web) rather than internals (language support in the engine).
- pritambarhate 6y agoApple's ToS prevent any kind of interpreted language in iOS apps. > 2.5.2 Apps should be self-contained in their bundles, and may not read or write data outside the designated container area, nor may they download, install, or execute code which introduces or changes features or functionality of the app, including other apps. Educational apps designed to teach, develop, or allow students to test executable code may, in limited circumstances, download code provided that such code is not used for other purposes. Such apps must make the source code provided by the Application completely viewable and editable by the user. Basically embedding any interpreted language inside the app is frowned upon by apple. But historically they have allowed JavaScript and Lua scripts to be embedded in apps.
- fpoling 6y agoThat does not ban the interpreters. It prevents interpretation of downloaded code. But as long the sources to be interpreted are bundled with app, it is OK at least from that section.
- Cullinet 6y ago"Such apps must make the source code provided by the Application completely viewable and editable by the user." arguably the ability to view source was what created the possibilities of the Web, and as such I don't read this term to be restrictive but instead merely trying to get the best outcome for everyone. disclaimer being that I have spent a large part of the past year evaluating a ios app for commercial release that both relies on decades of proprietary design and which probably doesn't have a significant future unless it is opened extensively or completely.
- realPubkey 6y agoIs there any performance comparison with the "default" js engine of react native?
- mateioprea 6y agoYes, here: https://engineering.fb.com/2019/07/12/android/hermes/ https://engineering.fb.com/2019/07/12/android/hermes/ Scroll down to: How Hermes improves React Native performance
- amelius 6y agoI find this interesting: > Hermes today has no JIT compiler. This means that Hermes underperforms some benchmarks, especially those that depend on CPU performance. This was an intentional choice: These benchmarks are generally not representative of mobile application workloads. What workloads are different from mobile application workloads, other than server-side code?
- lifthrasiir 6y agoNon-mobile web application workloads?
- dgellow 6y agoIf you continue, just after the bloc you quoted: > Because JITs must warm up when an application starts, they have trouble improving TTI and may even hurt TTI. Also, a JIT adds to native code size and memory consumption, which negatively affects our primary metrics. A JIT is likely to hurt the metrics we care about most, so we chose not to implement a JIT. So it seems to be specific to their TTI (Time To Interact) metric. A server application generally has the time to warm-up to reach best-performances (pretty common in the java world for example) while a mobile application has to react to user inputs as soon as possible.
- amelius 6y agoDoes this mean that V8 (which uses a JIT compiler) is a bad fit for web browsers? I think they exaggerate: > A JIT is likely to hurt the metrics we care about most And they ruled out the possibility of having both a JIT and ahead of time compilation.
- eatonphil 6y agoThis site doesn't seem to describe much about the history or internals. This FB blog post seems to have more details on how and why: https://engineering.fb.com/2019/07/12/android/hermes/ https://engineering.fb.com/2019/07/12/android/hermes/
- pfraze 6y agoDoes Hermes use a custom bytecode or is it using wasm?
- dgellow 6y agoCustom bytecode from what I get from their documentation (https://hermesengine.dev/docs/design#hermes-bytecode-generator https://hermesengine.dev/docs/design#hermes-bytecode-generat...). You can check the playground to see it in action: https://hermesengine.dev/playground/ https://hermesengine.dev/playground/.
- bdahz 6y agoHow does it compare to QuickJS?
- esprehn 6y agoAccording to this benchmark much larger binary size, but similar performance: https://bellard.org/quickjs/bench.html https://bellard.org/quickjs/bench.html that was a while ago though.
- gigel82 6y agoAlso, standard support is abysmal in Hermes, whereas full ES6 support is already there for QuickJS.
- ridiculous_fish 6y agoHermes is ES6 compliant to my knowledge.
- nicoburns 6y agoNot exactly by the looks of things. Kangax says 71% compliant. We tried Hermes at work and had to turn it off again because our app was crashing. That was before they implemented Proxy support, but I'm a little loathe to try it again. https://kangax.github.io/compat-table/es6/#hermes0_7_0 https://kangax.github.io/compat-table/es6/#hermes0_7_0
- ridiculous_fish 6y agoMy mistake, looks like some of the ES6 work is yet to be finished.
- serguzest 6y agoFormatting C++ code with 80 column hard limit looks bad.
- selimnairb 6y agoAll of these JavaScript frameworks are recreating native runtimes on top of “standard” JavaScript engines. It seems wrong to me to tailor a JavaScript engine to a particular framework. Ideally the goal would be to move native framework-less JavaScript forward so that we don’t need all these over-complex competing frameworks.
- runawaybottle 6y agoShouldn’t this be a hidden layer under React native? The thing you suggest is impossible without having Google or Apple take up the initiative. All JS improvements for the last 10 years required a lot of bypassing of browser and device maker’s implementation.
- cellularmitosis 6y agoThe primary React Native performance issue on iOS is that Apple disables the JIT when using JavaScriptCore. If you run some JS in a WKWebView you should see it speed up by 5 to 10x. (WKWebView runs in a different process, so they allow the JIT)
- Cthulhu_ 6y agoTo be anal, the root cause of that is using javascript instead of building a native app. I get that Facebook has the biggest apps on any platform and they run into platform limitations (like number of classes on Android) and build cycles so for them it makes sense to make a dynamic partial-hot-reloading-in-place app development framework, but they're still beholden to the runtime that Apple offers them. (In theory they could compile JS to a compiled binary that Apple's reviewers are okay with, but I don't know enough about any of that)
- JUNGLEISMASSIVE 6y agoThe security implications of running JS in an interpreter and running native bytecode are very different, though. Native apps also routinely request much more permissions and gather extra user data such as contacts, just because it is possible to do so.
- matchbok 6y agoDon't use FB made tools, please. The company is cancer.
- deleted 6y ago[deleted]
- ARandomerDude 6y agoBut my small company isn't. And using ReactNative gets us there easier/faster/cheaper than we ever could without it.
- broberts01 6y agoAgreed. With a two person team and we can do things we couldn't otherwise. Having one shared code base for web, android, and iOS is better for two people IMO.
- deleted 6y ago[deleted]
- kgin 6y agoWhat’s the reasoning here? Facebook will change the way they operate when people boycott paying the $0 to use their open source projects?
- notsrg 6y agoUsing tools made by FB doesn't imply support for the company. Ultimately having FB open source React/RN has been great for open source - by the time it hits public release it's already been battle tested internally.
- BillinghamJ 6y agoYou can have negative views of FB, but this comment doesn't belong on HN.
- random_savv 6y agoI'm looking forward to using Hermes in our RN project when it's fully featured. For us, it's sadly still missing Intl.Collator, which we need to correctly sort international characters, although it's in the works!
- inbx0 6y agoUnlike support for something like Proxies (which was recently added), isn't Intl.Collator fairly easily polyfilled?
- lil_dude 6y agoidk really guys feels like shit
- phreack 6y agoI'm not an expert on JS engine internals, but every time I used Hermes on a reasonably large React Native app, on Android performance absolutely tanked. It's been like that for over a year, and I just ended up disabling it, or enabling the debugger so the engine turns to Chrome's. There's always been some activity around it on the issue tracker[0] but not many solutions. [0] https://github.com/facebook/react-native/issues/25986 https://github.com/facebook/react-native/issues/25986 and related issues