Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1110757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T02:26:34+00:00 2026-05-17T02:26:34+00:00

The title pretty much sums it up but I was wondering why systems like

  • 0

The title pretty much sums it up but I was wondering why systems like .net compile code every time it is run instead of just compiling it once on the target machine?

  • 1 1 Answer
  • 2 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T02:26:35+00:00Added an answer on May 17, 2026 at 2:26 am

    There are two things to be gained by using an intermediate format like .NET or Java:

    1. You can run the program on any platform, exactly because the code is represented in an intermediate format instead of native code. You just need to write an interpreter for the intermediate format.
    2. It allows for some run-time optimizations which are not (easily) possible at compile-time: for example, you can take advantage of special features on new CPUs, even if those CPUs didn’t exist when you wrote your program – only the JIT compiler needs to know about that.

    Now, as for why you might not want to perform the compilation on the first run and then just cache that – there can be a couple of reasons for that as well.

    If you compile before startup, then the user has to wait a lot longer for that first run – at that point in time, you can’t know what the user will actually use. By only compiling what you need, when you need it, you can start much quicker, simply because you have less work to do, and you don’t store a lot of code that the user will never use (which for a large program can be a lot of code).

    If you start caching the JIT’ted code across sessions, you need to keep track of what has already been compiled and then store it to disk. For a large program, you might have a lot of native code to load from disk. Disk I/O is quite expensive, so it might just take longer to wait for the disk than to re-JIT it. Additionally, you need to keep track of how long that cache is usable. If the hardware changes, you might want to re-JIT in order to apply some new optimizations. If the program changes, you can’t use any of your old compiled code. If the run-time compiler changes, then a security bug might have been fixed, and you need to recompile to make sure that bug doesn’t remain in your native code.

    Basically, the JIT compiler suddenly has a lot more work to do (including disk I/O to deal with the cache) and becomes much more complicated and slow, reducing the point of JIT’ing.

    Now, that doesn’t mean that it can’t sometimes be advantageous to pre-compile certain assemblies, and as Matthew Ferreira points out, that’s what the ngen tool can do – but in the general case, it’s just not worth doing that, because JIT compilation is often more than fast enough.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Well the title Question pretty much sums it up, But I'd like to detail
Title pretty much sums it up, I think. I'd like to know if it's
So the Title pretty much sums up my problem, but I'm not sure what
The title pretty much sums up my question, but here are more details: I'm
Title pretty much sums it up. The external style sheet has the following code:
Title pretty much says everything. would like to print (NOT in decimal), but in
The title of the question pretty much sums it up, I'd like my view
The question title pretty much sums it up. I'm wondering if it's possible to
The title pretty much sums it up, normally in an IDE like Eclipse or
Title pretty much sums it up. I'd like to write a script to import

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.