0% found this document useful (0 votes)
3 views

Compilation in .NET

.NET applications are compiled into a language-agnostic Common Intermediate Language (CIL) and executed via Just-In-Time (JIT) or Ahead-Of-Time (AOT) compilation. JIT compilation translates Intermediate Language (IL) code into machine code during execution, optimizing performance by only compiling executed methods. AOT compilation generates machine-readable code prior to execution, enhancing startup times and performance, particularly in resource-critical environments.

Uploaded by

sodahi1806
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Compilation in .NET

.NET applications are compiled into a language-agnostic Common Intermediate Language (CIL) and executed via Just-In-Time (JIT) or Ahead-Of-Time (AOT) compilation. JIT compilation translates Intermediate Language (IL) code into machine code during execution, optimizing performance by only compiling executed methods. AOT compilation generates machine-readable code prior to execution, enhancing startup times and performance, particularly in resource-critical environments.

Uploaded by

sodahi1806
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Copyright© 2022 Mohammed Abu-Hadhoud

ProgrammingAdivces.com MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
26+ years of experience
Copyright© 2022 Mohammed Abu-Hadhoud
ProgrammingAdivces.com MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
26+ years of experience
Copyright© 2022 Mohammed Abu-Hadhoud
ProgrammingAdivces.com MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
26+ years of experience
Compilation
• .NET applications are written in
the C#, F#, or Visual Basic
programming language. Code is
compiled into a language-agnostic
Common Intermediate Language
(CIL). Compiled code is stored in
assemblies—files with a .dll or
.exe file extension.
• When an app runs, the CLR takes
the assembly and uses a just-in-
time compiler (JIT) to turn it
into machine code that can
execute on the specific
architecture of the computer it
is running on.

Copyright© 2022 Mohammed Abu-Hadhoud


ProgrammingAdivces.com MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
26+ years of experience
Compilation
In .NET, the compilation process occurs in two stages:
1. just-in-time (JIT) compilation.
2. ahead-of-time (AOT) compilation.

Copyright© 2022 Mohammed Abu-Hadhoud


ProgrammingAdivces.com MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
26+ years of experience
JIT: JUST In Time Compilation.
• Just-in-Time (JIT) Compilation: During the execution of a .NET
application, the CLR performs JIT compilation of the application's
Intermediate Language (IL) code into machine code. The JIT compiler
translates the IL code into native machine code for the target
platform on which the application is running. This allows the
application to take advantage of the full performance of the target
platform's hardware. The JIT compiler only compiles the methods
that are actually executed, so applications start up quickly, and
unused code is never compiled.

Copyright© 2022 Mohammed Abu-Hadhoud


ProgrammingAdivces.com MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
26+ years of experience
AOT: Ahead of Time Compilation.
• AOT stands for Ahead-of-Time, which is a method of compiling .NET code into
machine-readable code that can be executed directly by the computer's
processor, without requiring an interpreter or just-in-time (JIT)
compilation. This approach can lead to faster start times and better
performance compared to JIT-compiled code.

• AOT-compiled .NET code is often used in scenarios where performance and


startup time are critical, such as in mobile or embedded devices, or in
cloud environments where instances are frequently restarted. The AOT-
compiled code is optimized for the specific architecture and can take
advantage of hardware features such as instruction set extensions and
hardware acceleration.

• In .NET, AOT-compilation is usually performed using the Native Image


Generator (Ngen.exe) tool, which creates a native image from an existing
.NET assembly. The native image can then be deployed and executed on the
target machine, without requiring the .NET runtime to be installed.

Copyright© 2022 Mohammed Abu-Hadhoud


ProgrammingAdivces.com MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
26+ years of experience
Copyright© 2022 Mohammed Abu-Hadhoud
ProgrammingAdivces.com MBA, PMOC, PgMP®, PMP®, PMI-RMP®, CM, ITILF, MCPD, MCSD
26+ years of experience

You might also like