GithubHelp home page GithubHelp logo

Comments (2)

mhorowitz avatar mhorowitz commented on April 20, 2024

Hermes optimizes for its primary metrics of startup time, size, and memory utilization. These aren't specific to React Native, but they were informed by it.

Hermes makes different trade-offs than other VMs in order to optimize for its core metrics. In particular, Hermes has no JIT (just in timer compiler), because JITs are mainly useful for improving the performance of longer running, CPU intensive programs. A JIT also consumes more memory than an interpreter. I expect that JS which is not React Native can benefit from Hermes, but not that Hermes will be an improvement for all possible JS programs.

Given the very long evaluation time of vue.js on both VMs which you have measured, I suspect that the JIT is kicking in and JSC execution benefits from this.

from hermes.

mhorowitz avatar mhorowitz commented on April 20, 2024

Another observation (thanks to @jbower-fb) is that if you use prepareJavaScript() on device, you are not getting the most optimized possible code. This is a tradeoff to reduce on-device compilation time and is intended for simple code or testing on slow devices. For production use, the engine design expects that the JS source is compiled offline. You should use the command line hermes compiler, with the -O flag to generate bytecode with full optimizations.

Another optimization which RN uses which you can use, too, is to mmap the bytecode instead of eagerly loading it. https://github.com/facebook/hermes/blob/master/API/jsi/jsi/jsilib.h#L14 is some library code which will do this for you.

from hermes.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.