www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Could D benefit from JIT compiling?

reply Xinok <xinok live.com> writes:
Reading through the 'Java > Scala' thread, I've realized there are some 
benefits to dynamic code generation vs statically compiled code. Things 
like unrolling loops, devirtualizing functions, etc.

So it made me wonder, could D benefit from such technology, not from a 
feature standpoint, but strictly optimization? I'm not familiar with the 
topic, but I imagine there could be a few situations that would benefit 
in terms of performance, as long as it doesn't affect interoperability.
Dec 02 2011
next sibling parent Timon Gehr <timon.gehr gmx.ch> writes:
On 12/02/2011 04:46 PM, Xinok wrote:
 Reading through the 'Java > Scala' thread, I've realized there are some
 benefits to dynamic code generation vs statically compiled code. Things
 like unrolling loops, devirtualizing functions, etc.

 So it made me wonder, could D benefit from such technology, not from a
 feature standpoint, but strictly optimization? I'm not familiar with the
 topic, but I imagine there could be a few situations that would benefit
 in terms of performance, as long as it doesn't affect interoperability.

There could be cases where it helps somewhat. I don't expect that the benefit in comparison to normal compilation to native code would be very high, because - You already got native code. - The optimizer might have used some advanced dynamic instrumentation, leading to similar performance effects as the use of a tracing JIT optimizer, if the typical tasks stay roughly the same. Actually getting it to work for comparison certainly would be an interesting experiment though.
Dec 02 2011
prev sibling next sibling parent "Martin Nowak" <dawg dawgfoto.de> writes:
On Fri, 02 Dec 2011 16:46:19 +0100, Xinok <xinok live.com> wrote:

 Reading through the 'Java > Scala' thread, I've realized there are some  
 benefits to dynamic code generation vs statically compiled code. Things  
 like unrolling loops, devirtualizing functions, etc.

 So it made me wonder, could D benefit from such technology, not from a  
 feature standpoint, but strictly optimization? I'm not familiar with the  
 topic, but I imagine there could be a few situations that would benefit  
 in terms of performance, as long as it doesn't affect interoperability.

- CTFE - things typically done using whole program optimization - flexible runtime plugins - some loop unrolling but the performance win stagnates with the latest generation X86 CPUs due to the micro op decoding cache
Dec 02 2011
prev sibling parent Hans Uhlig <hans.uhlig teamaol.com> writes:
On 12/2/2011 7:46 AM, Xinok wrote:
 Reading through the 'Java > Scala' thread, I've realized there are some
 benefits to dynamic code generation vs statically compiled code. Things
 like unrolling loops, devirtualizing functions, etc.

 So it made me wonder, could D benefit from such technology, not from a
 feature standpoint, but strictly optimization? I'm not familiar with the
 topic, but I imagine there could be a few situations that would benefit
 in terms of performance, as long as it doesn't affect interoperability.

Best place to experiment with this would be in llvm, I believe one of the projects is to do this with C/C++ IR code.
Dec 05 2011