Running D in the Java VM

inout inout at gmail.com
Thu Nov 21 14:33:03 PST 2013


On Thursday, 21 November 2013 at 22:02:14 UTC, Paulo Pinto wrote:
> Am 21.11.2013 21:25, schrieb inout:
>> On Thursday, 21 November 2013 at 07:35:01 UTC, Volcz wrote:
>>> On Sunday, 17 November 2013 at 05:49:43 UTC, John J wrote:
>>>> On 11/15/2013 02:13 AM, Jeremy DeHaan wrote:
>>>> If it should survive as an alternative, Jave should have 
>>>> some more
>>>> advantages over D, even after the D compiles to ARM.
>>>
>>> The Android NDK is only a second class citizen compared to 
>>> the Java
>>> SDK. The only use case I have heard of for the NDK is when 
>>> companies
>>> have a small C library with common functionality to make 
>>> porting the
>>> products to other platforms easier.
>>
>> That's not true. Most games are written entirely with NDK. Many
>> applications, too (the app my team shipped recently contains a 
>> fair
>> amount of C++ code in it, and it only grows).
>
> NDK only covers game related APIs, mostly.
>
> How much JNI calls do you make in standard applications?
>
> --
> Paulo

Everything accessible from Java is also accessible from NDK (by 
using reflection or by calling Java code from C++), so saying 
"NDK only covers game related APIs" is somewhat wrong.

I can only tell about our application, but it has a lot of JNI 
code. It is mostly used as a message passing mechanism between  
Java and C++ (which live in separate threads so that Java GC 
doesn't stop native code execution).

It's still experimental, but offloading some of the Java logic to 
C++ gave as a significant performance boost, especially 
noticeable on low-end devices.

A good example of the Java/C++ mix is a Chrome browser in 
Android. I'd say it's 50% Java/50% C++ (not counting the WebKit 
part).


More information about the Digitalmars-d-announce mailing list