News for hackers. Stuff that matters.
Re:The strange case of virtual machines on telephones by bad_user on Thursday August 26, 2010 @05:12PM (#1637184)
Straw man alert !

I have multiple arguments on why I prefer virtual machines (like the JVM), and none of them is security ...

     - portability between hardware architectures
     - portability between operating systems (mostly)
     - memory management that doesn't suck
     - and yes, decent speed in return for a high-level programming language
Also, in time Java gained an extra advantage ... open-source libraries that are fucking top-notch, in some cases with no replacement in the "native" department.

Regarding Android versus iPhone ... that iPhone emulator doesn't run on anything else other than OS X, or does it?

Re:The strange case of virtual machines on telephones by pkaler on Thursday August 26, 2010 @09:31PM (#1637750)
There are pros and cons to each of your points. It just so happens Apple chose almost the exact opposite when compared to Android.

     - portability between hardware architectures
Android went with the VM solution. Apple chose fat binaries when going from PPC to X86. They also use fat binaries for ARMv6 and ARMv7.

     - portability between operating systems (mostly)
Apple handles this at the OS, framework, C language, and compiler (LLVM) level. The Unix bits of OS X and iOS are essentially the same. CoreFoundation is essentially the same across iOS and OS X. Cocoa and Cocoa Touch share the same design ethos as well as a number of classes.

If you assume Unix then a VM isn't that big of an OS portability win.

In general, Apple doesn't believe in cross-platform Apps. They believe in trans-platform Apps. Every single pixel in a Mac, iPhone, or iPad App should be pixel perfect. Java and a VM doesn't really give you any benefits with respect to this.

     - memory management that doesn't suck
Objective-C 2.0 on Mac OS X has garbage collection. I imagine garbage collection will come to the iOS world when Apple believes that the performance tradeoffs make sense.

In general, memory management is hard. Memory leaks are trivial to find for an experienced programmer with Instruments. Leaks are tough for a novice programmer. But hey, life is tough for a novice programmer.

Memory management involves more than just garbage collection. Running out of memory is a big problem on handheld devices. A VM can compact memory but you can't do anything about VM memory overhead.

     - and yes, decent speed in return for a high-level programming language
I'd argue that a message passing language like Objective-C is actually just as high-level (if not more) than a method calling language like Java.
Re:The strange case of virtual machines on telephones by wmf on Thursday August 26, 2010 @05:26PM (#1637211)
memory management that doesn't suck

You can have GC and AOT compilation, as the post says in a footnote.

decent speed in return for a high-level programming language

High-level languages can be AOT compiled.

Java gained an extra advantage ... open-source libraries that are fucking top-notch

So maybe Android should have used Java, but compiled it direct to ARM rather than burning users' cycles on an interpreter.

Re:The strange case of virtual machines on telephones by bad_user on Thursday August 26, 2010 @08:01PM (#1637580)
> So maybe Android should have used Java, but compiled it direct to ARM rather than burning users' cycles on an interpreter.

It doesn't have to be an interpreter, the processor itself can be optimized for Java (or whatever bytecode you'd like), a point the article also missed.

This has been going on since 1996 ... http://bwrc.eecs.berkeley.edu/CIC/announce/1996/java-procs.h... (and the concept itself was first tried with the Lisp machines I think).

The difference between high-end phone makers, like Apple, and the low-end phone makers ... low-end phone makers cared and still care only about price, not about how snappy those Java apps run.

Again ... the article sets up a straw man.

Desktop Java applications are slow and ugly, but show me an open-source IDE that can compete with the breath and depth of Eclipse / IntelliJ IDEA and their plugin ecosystem.

There's some merit to Java in that ... open-source developers would rather spend their time working on the features they want, rather than hunting down memory-leaks or deal with all the shit that cross-platform development brings.

Re:The strange case of virtual machines on telephones by astrange on Thursday August 26, 2010 @09:14PM (#1637720)
> It doesn't have to be an interpreter, the processor itself can be optimized for Java (or whatever bytecode you'd like), a point the article also missed.

This is slower than compiling it to a more easily implemented ISA.

Re:The strange case of virtual machines on telephones by MaysonL on Friday August 27, 2010 @12:58PM (#1639358)
show me an open-source IDE that can compete with the breath and depth of Eclipse

... Eclipse?

Re:The strange case of virtual machines on telephones by runT1ME on Thursday August 26, 2010 @06:29PM (#1637353)
AOT in many instances is less performant than JIT compilation...
Re:The strange case of virtual machines on telephones by rphlx on Friday August 27, 2010 @01:24AM (#1638086)
I doubt it, but, regardless, AOT burns AC power once, on some development PC. JIT/interpretation burns power forever from a tiny LiPoly cell that barely lasts 10 hrs for many people. And with 160k new devices per day, I wonder how many unnecessary tons of CO2 it produces each year?