1. imekul's Avatar
    I realize this may sound kind of dense, so please bear with me.

    I know very little about Android apps, other than to know that they are written in Java (right?).

    Anyway, I've always heard people gripe about "Oh, Java is slow. Java's bloated." In my personal experience, I've got to say that I always groan when I have to use a Java app on a website. It has always struck me as slow or clunky.

    So because of the past experience with Java and also the negative comments I've read about it over the years, when I heard that Android apps were written in Java, I just wondered if that crippled their performance or potential in any way.

    Clearly, I'm not very familiar with Java or with Android itself. But I wonder if somebody who knows a little bit more could help enlighten me.

    Is there any truth to Java inherently being slow? Would an Android app have the same potential that, say, an iPhone app would? Is there any performance hit simply because the app is written in Java versus C or whatever?

    I realize that obviously the hardware makes a difference. But I'm just wondering if I have the wrong view of Java in the first place. I'm thinking I probably do.

    In short, are there any obvious drawbacks from Android apps being written in Java versus C or some other language?

    Thanks for reading! I hope his makes enough sense.
    09-22-2009 02:15 AM
  2. arnodenhond's Avatar
    While it is true that Android apps are written according to Java syntax, the command libraries (API) which a programmer can use in his apps are quite different from Java.

    Compiling and Android app is very different from compiling a Java app. Android apps are not compiled into class files but into a single dex file which is much more effecient. Android apps run on a Dalvik virtual machine which is also very different from a Java virtual machine.

    But even normal Java is not inherently slow. The reason why Java applets on websites seem slow and clunky is because 1) the app needs to be downloaded and 2) the entire Java virtual machine needs to be started if it isn't running yet. In theory the virtual machine could even be so tightly integrated into the operating system that this translation layer hardly reduces efficiency at all.

    As for comparisons to other languages, the Java syntax is actually nearly identical to C.
    Everybody agrees C is a fast language. Perhaps the missing understanding is that the syntax in which an application is written can be totally different from the way the app is compiled and executed.

    Hope this clarifies.
    09-22-2009 10:41 PM
  3. ram_sg's Avatar
    @arnodenhond, in simpler terms, am i right in saying that it really depends more on the 'OS' than the language in which the app is written?
    09-23-2009 01:10 PM
  4. anon(697)'s Avatar
    More that it depends on how the code is compiled and/or interpreted
    09-23-2009 01:11 PM
LINK TO POST COPIED TO CLIPBOARD