News for hackers. Stuff that matters.
Re:A performance comparison between Java and C on the Nexus 5 by bluerobotcat on Monday April 14, 2014 @10:26AM (#7586316)
In the long run, having a more modern language should benefit Android because it means the barrier of entry is lower for programmers.

In the meantime it does seem likely that Java has a non-negligible performance cost. My personal worry is that fast Garbage Collectors usually assume that twice the memory is available than is used. That might put the fact that Android phones typically have more memory than Apple devices in an interesting light.

Re:A performance comparison between Java and C on the Nexus 5 by pkolaczk on Monday April 14, 2014 @12:09PM (#7586994)
I found two problems with your reasoning:

First, the overhead of GC depends not only on the heap size, but also on the allocation rate and allocation profile. For reasonable allocation rates found in typical GUI apps, most Java GCs do extremely well having very little additional memory, like only 20% more than the live set size. There is no "twice as much" assumption anywhere in their design.

Second, manual memory managers do have their own overhead too, in form of bookkeeping (e.g. free lists) and internal fragmentation. Fragmentation can be sometimes much worse than GC memory overhead for long running applications, because GC memory overhead is typically bounded, while fragmentation is either unbounded or has extremely high upper bounds (like 10x in "fast" allocators).

Re:A performance comparison between Java and C on the Nexus 5 by munificent on Monday April 14, 2014 @01:20PM (#7587483)
> There is no "twice as much" assumption anywhere in their design.

There is in that the nursery collector is often a simple Cheney-style copying collector that wants two semispaces. But that's only one of the generations. There's definitely no requirement that total GC memory is double the used space.

Re:A performance comparison between Java and C on the Nexus 5 by rsynnott on Monday April 14, 2014 @11:38AM (#7586770)
_Is_ Java significantly more 'modern', than Objective C, though? How? It's not like it's much newer; development started in 1991, vs early 80s for ObjC.
Re:A performance comparison between Java and C on the Nexus 5 by pjmlp on Monday April 14, 2014 @01:17PM (#7587462)
- GC

- namespaces

- memory safe

- you don't have to type @ and [] everywhere to switch between dynamic and static worlds

As for the vm thing, there are also commercial native compilers, even though the general HNer tend not to be aware of them.

Re:A performance comparison between Java and C on the Nexus 5 by rsynnott on Monday April 14, 2014 @05:02PM (#7588920)
> GC

Thus giving Android developers all the fun of dealing with GC pauses. There's a lot to be said for ARC, really; I'm quit glad Apple ditched their brief experiment with ObjC GC.

> namespaces

I'll give you that one; lack of namespaces it the worst thing about ObjC.

> ... Dynamic and static worlds...

I'm not sure what you mean here; Java is a statically typed language, and does not have a 'dynamic world'. ObjC has a fo of optional dynamic typing, which is arguably modern, though also only arguably a good thing.

Re:A performance comparison between Java and C on the Nexus 5 by pjmlp on Monday April 14, 2014 @05:25PM (#7589059)
> I'm quit glad Apple ditched their brief experiment with ObjC GC.

Because they failed to implement a GC that didn't crash all the time, as the Apple forums used to testify before ARC was touted as the best thing since sliced bread.

The wonders of mixing Objective-C libraries compiled in mixed mode.

> I'm not sure what you mean here;

The mixed nature of Objective-C.

With @ and [] one is in Smalltalk land. Without them, one is in C world.

> Java is a statically typed language, and does not have a 'dynamic world'.

Yes it has, via reflection, annotations and dynamic bytecode generation.

Re:A performance comparison between Java and C on the Nexus 5 by msbarnett on Monday April 14, 2014 @05:38PM (#7589120)
> With @ and [] one is in Smalltalk land. Without them, one is in C world.

This is an odd and not particularly true way of looking at things. [] (for message sending), is merely some syntactic sugar for the objc_msgsnd function call.

Re:A performance comparison between Java and C on the Nexus 5 by pjmlp on Tuesday April 15, 2014 @01:51AM (#7590473)
Which could have been implemented in a better way, e.g. Dylan does dynamic dispatch with multi-methods without requiring me to type [] everywhere. A real pain in non US keyboards.
Re:A performance comparison between Java and C on the Nexus 5 by rat87 on Tuesday April 15, 2014 @04:56AM (#7590939)
Also Dynamic casts(w/exceptions) and virtual methods/Dynamic dispatch which do provide some dynamicity not easy/natural in c.
Re:A performance comparison between Java and C on the Nexus 5 by mikeash on Monday April 14, 2014 @09:49PM (#7589900)
Your first three points are good, but are you seriously suggesting that Java is "more modern" because its method call syntax uses a dot instead of brackets?
Re:A performance comparison between Java and C on the Nexus 5 by pjmlp on Tuesday April 15, 2014 @01:54AM (#7590480)
Yes, because [] was a pre-processor hack back when Objective-C was invented and the compiler was actually a translator to C.

A means of gathering the code, dump it into a series of objc_msgsnd, without doing much of real compiler work.

There are languages with Smalltalk semantics without forcing me to type @ and [] multiple times per line, a pain in non US keyboards.

Re:A performance comparison between Java and C on the Nexus 5 by antimagic on Tuesday April 15, 2014 @06:50AM (#7591166)
Seriously? And all of those {} that you type in Java-land, they're magically easy to type? Which is of course a red-herring, because neither is enough of a drama to be taken seriously. You deal with it for a day or two and then forget about it.
Re:A performance comparison between Java and C on the Nexus 5 by mikeash on Tuesday April 15, 2014 @10:30AM (#7591995)
What kind of code are you writing where you have to type @ multiple times per line?
Re:A performance comparison between Java and C on the Nexus 5 by pjmlp on Tuesday April 15, 2014 @11:56AM (#7592501)

    id map = @{ @"my key": @123};
Re:A performance comparison between Java and C on the Nexus 5 by rsynnott on Thursday April 17, 2014 @11:38AM (#7604252)
Of course, in Java, this would look like (at best, using a third party thing):

ImmutableMap.builder().put("my key", 123).build();

Which hardly seems neater (especially in a more realistic case where you have more than one entry).

Re:A performance comparison between Java and C on the Nexus 5 by pjmlp on Thursday April 17, 2014 @01:44PM (#7605064)
The point was the pain to type @ in keyboards other than US.
Re:A performance comparison between Java and C on the Nexus 5 by mikeash on Tuesday April 15, 2014 @12:48PM (#7592866)
Surely you're not doing that anywhere close to every line.
Re:A performance comparison between Java and C on the Nexus 5 by pjmlp on Monday April 14, 2014 @01:08PM (#7587396)
The main issue is the quality of Google's implementation, don't generalize the language vs implementation.

Apparently they haven't done any changes since JIT was introduced in 2.3 version. Additionally we have ART without any information whatsoever about future plans.