Difference between JIT and AOT?

JIT (Just-In-Time) Compilation and AOT (Ahead-Of-Time) Compilation are two different compilation techniques used in Angular.

JIT Compilation:

  • Compiles the application in real-time, during runtime.
  • Compilation happens in the browser, on the user’s machine.
  • Suitable for development mode as it provides quick feedback on the changes made to the code.
  • Slower initial load time, as the application has to be compiled in the browser before it can be executed.

AOT Compilation:

  • Compiles the application before it is deployed, during the build process.
  • Compilation happens on the development machine.
  • Suitable for production mode as it results in faster load times, since the application has already been compiled and optimized.
  • Larger file size as the compiled application has to be shipped to the browser.

In conclusion, JIT Compilation is best for development mode and AOT Compilation is best for production mode. Angular provides both JIT and AOT compilers and you can switch between them by using the appropriate build command.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *