JIT is one of those newfangled business
acronyms that's thrown around in board
meetings and on news sites all the time
but what is it what does it have to do
with Android that's what we're gonna
learn on today's episode of the android
power-user so JIT sometimes pronounced
JIT what is it well it stands for
just-in-time
it's always good to be on time right
well what does it mean for that we got
to go to logistics you ready for this
one we'll keep it short in logistics
supply and demand production lines
assembly lines whatever you want to call
it JIT is the concept of having
inventory delivered just when you need
it
just-in-time if you're a manufacturer of
widgets and you need some cogs well you
don't want to have a whole bunch of cogs
on hand because inventory is expensive
warehouses to hold that inventory are
expensive insurance to prevent or to
make up for break-ins on those cogs is
expensive so if you can cut down all of
that inventory and get your stuff just
in time well you're great unfortunately
there are some drawbacks to that like
what happens if there's a hurricane or
flood or you don't have a reliable cog
maker darn Cogswell
well in that case you're gonna have
problems on your production line but
that's kind of where the JIT metaphor
breaks down so what are we talking in
terms of JIT and Android JIT in
computers and let's face it androids are
computers comes down to something that's
sometimes referred to as dynamic
translation essentially you're running
your program right when you need it
you're not really running it and that's
where things get a little bit
complicated so before we uncomplicated a
a little background in computers
computer
development I'm a developer for my day
job I write code all day long but the
code that I write is all c-sharp net
I've coded in other stuff I've coded in
Pascal and Visual Basic in C and C++ and
even in Java but they're all essentially
the same thing they are a programming
language it's somewhat easy to program
in a programming language at least when
compared to programming in native code
native code is the code that programs
are run in so if you want to run any
application any program at all desktop
tablet smartphone doesn't matter you
have to run it in native code that's all
computers know how to run his native
code it wasn't written in native code it
might have been written in objective-c
or Java so how does it get from those
over into native code the way that all
works is something called compilation
the process of compiling is essentially
translating your code which is kind of
human readable and easy to understand at
least for geeks like me into something
that's really complicated and hard for
me to read but easy for a computer to
read and to execute that's the key right
there
being able to actually execute or run
the program or app downsides to
compiling compiling takes time head on
over to pocketnow.com look at the little
comic i've got on that it's awesome
though I don't necessarily like fencing
laser tag during compiling you know what
I'm talking about
but compiling it takes time and there
are limitations so let's step in the
Wayback Machine and talk about Windows
Mobile before it was called Windows
Mobile way back then we had pda's
running an operating system it was
Windows CE II and on that OS we could
install apps though back then they were
called programs those programs came in
various different formats and you had to
know which one you needed to run it on
your particular device C back then we
had strong arm we had MIPS I think we
even had a couple other
processors out there each processor has
advantages and disadvantages but they
couldn't run each other's programs so as
a developer you would write the code
once in your common language whether
that's a vbe or whatever and then you'd
compile it but you'd compile it for each
one of these processors so at the end of
the day you'd end up with like four or
five programs but they wouldn't be able
to run except on one particular platform
and well Windows Mobile or Pocket PC or
whatever we called it back then there
were lots of different manufacturers and
each one kind of liked having their own
different processor so you've had to
have different executables for each
processor kind of a pain in the neck
especially for developers who
essentially now have to compile it five
times not cool so what does any of this
have to do with Android after all
Android apps are written in Java right
oh yes they are but they're not running
Java they're run in you guessed it
machine code how do we get it from point
A to point B and how come you don't have
to pick from like five or six different
versions of an app when you're going to
the Play Store very good questions okay
so the Play Store thing has a couple
different answers first of all you
really shouldn't see apps that aren't
compatible with your device plain and
simple the Play Store does a fairly good
job at doing that sure you might see
them but you won't be able to install
them it's close and yes there are
different versions of different apps for
different platforms and screen
resolutions and whatnot but we're not
going to get into that today instead
what we're going to talk about is
something that Android does that's a
little bit different you see it runs all
of your apps in what's called a virtual
machine again we're not going to talk
too much about that today instead we're
going to talk about something that
happened well somewhat recently it's
been a while but it didn't come around
with the invent of Android when it was
first released and it's called the JIT
compiler or running in JIT in the
compiler okay what does all that mean
that's a lot of jargon and acronyms
jit when applied computing means we're
taking our
uncompelled code that we as developers
write we as developers publish to the
Play Store our own websites some other
market really doesn't matter and somehow
it gets onto your phone once it's on
your phone you need to run it well to be
able to run it it has to be compiled
compiling as we already discussed takes
time that time translates into something
that we like to call lag you push a
button on the screen and it just sits
there and waits for a while and thinks
oh and then it does something that lag
is just painful it's not enjoyable it's
not fun it's not smooth and it's not
fast so that's the only things kind of
used to work they would be automatically
compiled when you ran them now that
sounds like just in time but it's not
just in time or JIT was introduced into
Android sometime ago and it really sped
things up quite a bit because it would
compile your code right when you want it
to run it and not all of it just the
stuff that you needed to be able to run
and then it got kind of super smart and
it started predicting what code you'd
need to compile next or what code it
would need to compile next for you to be
able to run does any of this make sense
let's back up so I have an app I install
it on my phone or my tablet I go ahead
and tap the icon what happens then is
that app portions of it are dynamically
compiled on the fly just enough to get
me started once that's done then the
rest is kind of pre compiled and put
into cache yes that's kind of an
oversimplification of how things work we
do that quite a bit on Android power
user but it gives you the idea just what
you need is compiled just when you need
it it's a lot faster and then in the
background the other stuff is
dynamically compiled and cached from
when you need it it's very intelligent
now what does this let us do let's back
up for just a minute I may have an
Android smartphone and an Android tablet
and they may be running
the same processor or I may be running
an Android tablet and the next Android
phone that comes out it might not be
running a Snapdragon processor it might
be running an intel possible but the
Intel processor doesn't have the same
codebase as that Snapdragon it's a
different architecture what does that
mean well in the Windows Mobile days
that means every single app developer
who has ever written an app for any
version of Android has to now recompile
their app and redistribute it for both
the Snapdragon and the Intel processors
it's a pain it's never gonna happen so
all of this gets kind of muddled
together and it would be painful so
Intel essentially would never be able to
make a processor that Android would run
on unless they switched over to the
Snapdragon architecture which they're
just not gonna do that would mean that
we'd all be relegated just a Snapdragon
that's not to say Snapdragon isn't great
it's just don't we want to be able to do
other stuff don't we want that freedom
as Android enthusiasts don't we want
that freedom of course we do so the way
Android is built all you have to do if
you're Intel is rewrite Android not
rewrite it but we compile it translate
it make it run on your infrastructure on
your architecture on your chips great
once you have that done in yes that
includes the operating system that
includes drivers that includes all the
apps that you need that are native apps
run written in native code you've got to
translate those but then all of the
other apps that are run through this JIT
compiler they're gonna work just fine
why because once you get that translator
working anything that's pre-written will
run on anybody else's platform that's
really the beauty of JIT that's why it's
so amazing and we're not even living up
to that potential yet so right now all
we have to do is live with you know the
increased speed the apps running just
when you need them the saved memory the
buttery smoothness we'll just have to
make do with that but in
future in the future will be able to
support many different platforms and
hopefully we'll see an Intel one that we
can actually buy some time soon so
that's the nuts and the bolts behind
what this JIT does now there's something
else involved there and it's called
dalvik but that's going to be the topic
for another episode of the Android power
user if you like this kind of discussion
make sure you give the video a big
thumbs up if you haven't subscribed
already make sure you hit the link at
the end of the video so that you can be
notified when we have new episodes not
just of Android power user but other
Android even Windows Phone and iPhone
stuff as well we'll go ahead and let you
know right there quick and easy if you'd
like to discuss comment ask questions
make sure you follow the link right down
at the bottom of this if you're watching
this on youtube so you can go over to
the discussion at pocketnow.com that's
where will we be having that for pocket
now the Android power user I'm Joe Levi
thanks for watching
We are a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for us to earn fees by linking to Amazon.com and affiliated sites.