<s>
In	O
computer	O
science	O
,	O
ahead-of-time	B-Application
compilation	I-Application
(	O
AOT	B-Application
compilation	I-Application
)	O
is	O
the	O
act	O
of	O
compiling	B-Language
an	O
(	O
often	O
)	O
higher-level	O
programming	O
language	O
into	O
an	O
(	O
often	O
)	O
lower-level	O
language	O
before	O
execution	O
of	O
a	O
program	O
,	O
usually	O
at	O
build-time	O
,	O
to	O
reduce	O
the	O
amount	O
of	O
work	O
needed	O
to	O
be	O
performed	O
at	O
run	B-Library
time	I-Library
.	O
</s>
<s>
Most	O
often	O
,	O
It	O
is	O
associated	O
with	O
the	O
act	O
of	O
compiling	B-Language
a	O
higher-level	O
programming	O
language	O
such	O
as	O
C	B-Language
or	O
C++	B-Language
,	O
or	O
an	O
intermediate	B-Application
representation	I-Application
such	O
as	O
Java	B-Language
bytecode	I-Language
or	O
.NET	B-Application
Framework	I-Application
Common	O
Intermediate	O
Language	O
(	O
CIL	O
)	O
code	O
,	O
into	O
a	O
native	O
(	O
system-dependent	O
)	O
machine	B-Language
code	I-Language
so	O
that	O
the	O
resulting	O
binary	O
file	O
can	O
execute	O
natively	O
,	O
just	O
like	O
a	O
standard	O
native	O
compiler	B-Language
.	O
</s>
<s>
When	O
being	O
used	O
in	O
this	O
specific	O
context	O
,	O
it	O
's	O
often	O
seen	O
as	O
an	O
opposite	O
of	O
just-in-time	O
(	O
JIT	O
)	O
compiling	B-Language
.	O
</s>
<s>
Speaking	O
more	O
generally	O
,	O
the	O
target	O
languages	O
of	O
an	O
AOT	B-Application
compilation	I-Application
are	O
not	O
necessarily	O
specific	O
to	O
native	O
machine	B-Language
code	I-Language
but	O
are	O
defined	O
rather	O
arbitrarily	O
.	O
</s>
<s>
Some	O
academic	O
papers	O
use	O
this	O
word	O
to	O
mean	O
the	O
act	O
of	O
compiling	B-Language
the	O
Java	B-Language
bytecode	I-Language
to	O
C	B-Language
or	O
the	O
timing	O
when	O
optimization	O
pipeline	O
are	O
performed	O
.	O
</s>
<s>
An	O
academic	O
project	O
uses	O
this	O
word	O
to	O
mean	O
the	O
act	O
of	O
pre-compiling	O
JavaScript	B-Language
to	O
a	O
machine-dependent	O
optimized	O
IR	B-Application
for	O
V8	B-Language
(	O
JavaScript	B-Language
engine	I-Language
)	O
and	O
to	O
a	O
machine	O
independent	O
bytecode	O
for	O
JavaScriptCore	O
.	O
</s>
<s>
Clojure	B-Language
and	O
Hermes	O
JavaScript	B-Language
engine	I-Language
)	O
use	O
this	O
word	O
to	O
mean	O
the	O
act	O
of	O
pre-compiling	O
the	O
source	O
language	O
to	O
VM	O
specific	O
bytecode	O
.	O
</s>
<s>
Angular	B-Language
(	O
web	O
framework	O
)	O
uses	O
this	O
word	O
to	O
mean	O
converting	O
its	O
HTML	B-Language
template	O
and	O
TypeScript	B-Language
to	O
JavaScript	B-Language
.	O
</s>
<s>
In	O
fact	O
,	O
since	O
all	O
static	B-Library
compilation	I-Library
are	O
technically	O
performed	O
ahead	O
of	O
time	O
,	O
this	O
particular	O
wording	O
are	O
often	O
used	O
to	O
emphasize	O
some	O
kind	O
of	O
performance	O
advantages	O
from	O
the	O
act	O
of	O
such	O
pre-compiling	O
.	O
</s>
<s>
The	O
act	O
of	O
compiling	B-Language
Java	B-Language
to	O
Java	B-Language
bytecode	I-Language
is	O
hence	O
rarely	O
referred	O
to	O
as	O
AOT	B-Application
since	O
it	O
's	O
usually	O
a	O
requirement	O
,	O
not	O
an	O
optimization	O
.	O
</s>
<s>
Some	O
programming	O
languages	O
with	O
a	O
managed	O
code	O
runtime	B-Library
that	O
can	O
be	O
compiled	B-Language
to	O
an	O
intermediate	B-Application
representation	I-Application
,	O
use	O
just-in-time	O
(	O
JIT	O
)	O
compiling	B-Language
.	O
</s>
<s>
This	O
,	O
briefly	O
,	O
compiles	B-Language
intermediate	O
code	O
into	O
machine	B-Language
code	I-Language
for	O
a	O
native	O
run	O
while	O
the	O
intermediate	O
code	O
is	O
executing	O
,	O
which	O
may	O
slow	O
an	O
application	O
's	O
performance	O
.	O
</s>
<s>
Ahead-of-time	B-Application
compiling	B-Language
eliminates	O
the	O
need	O
for	O
this	O
step	O
by	O
occurring	O
before	O
execution	O
rather	O
than	O
during	O
execution	O
.	O
</s>
<s>
Ahead-of-time	B-Application
compiling	B-Language
for	O
dynamically	O
typed	O
languages	O
to	O
native	O
machine	B-Language
code	I-Language
or	O
other	O
static	O
VM	O
bytecode	O
is	O
possible	O
in	O
a	O
limited	O
number	O
of	O
cases	O
only	O
.	O
</s>
<s>
For	O
example	O
,	O
the	O
High	O
Performance	O
Erlang	B-Operating_System
Project	O
(	O
HiPE	B-Operating_System
)	O
AOT	B-Application
compiler	I-Application
for	O
the	O
language	O
Erlang	B-Operating_System
can	O
do	O
this	O
because	O
of	O
advanced	O
static	O
type	O
reconstruction	O
techniques	O
and	O
type	O
speculations	O
.	O
</s>
<s>
In	O
most	O
situations	O
with	O
fully	O
AOT	B-Application
compiled	B-Language
programs	O
and	O
libraries	O
,	O
it	O
is	O
possible	O
to	O
remove	O
part	O
of	O
a	O
runtime	B-Device
environment	I-Device
,	O
thus	O
saving	O
disk	O
space	O
,	O
memory	O
,	O
battery	O
life	O
,	O
and	O
startup	O
times	O
(	O
no	O
JIT	O
warmup	O
phase	O
)	O
,	O
etc	O
.	O
</s>
<s>
AOT	B-Application
compilers	I-Application
can	O
perform	O
complex	O
and	O
advanced	O
code	O
optimizations	B-Application
,	O
which	O
in	O
most	O
cases	O
of	O
JITing	O
will	O
be	O
considered	O
much	O
too	O
costly	O
.	O
</s>
<s>
In	O
contrast	O
,	O
AOT	B-Application
usually	O
cannot	O
perform	O
some	O
optimizations	B-Application
possible	O
in	O
JIT	O
,	O
like	O
runtime	B-Library
profile-guided	O
optimization	O
(	O
PGO	O
)	O
,	O
pseudo-constant	O
propagation	O
,	O
or	O
indirect-virtual	O
function	O
inlining	O
.	O
</s>
<s>
AOT	B-Application
must	O
compile	B-Language
to	O
a	O
target	O
architecture	O
,	O
while	O
a	O
JIT	O
can	O
compile	B-Language
the	O
code	O
to	O
make	O
the	O
best	O
use	O
of	O
the	O
actual	O
CPU	O
it	O
is	O
running	O
on	O
,	O
even	O
years	O
after	O
the	O
software	O
has	O
been	O
released	O
.	O
</s>
<s>
Further	O
,	O
JIT	O
compilers	B-Language
can	O
speculatively	O
optimize	O
hot	O
code	O
by	O
making	O
assumptions	O
on	O
the	O
code	O
.	O
</s>
<s>
An	O
AOT	B-Application
compiler	I-Application
cannot	O
make	O
such	O
assumptions	O
and	O
needs	O
to	O
infer	O
as	O
much	O
information	O
as	O
possible	O
at	O
compile	B-Language
time	O
.	O
</s>
<s>
Such	O
problems	O
can	O
be	O
alleviated	O
by	O
profile-guided	O
optimizations	B-Application
.	O
</s>
<s>
But	O
even	O
in	O
this	O
case	O
,	O
the	O
generated	O
code	O
cannot	O
be	O
adapted	O
dynamically	O
to	O
the	O
changing	O
runtime	B-Library
profile	O
as	O
a	O
JIT	O
compiler	B-Language
would	O
do	O
.	O
</s>
