Porting C# code

Iivari Mokelainen iivari at mokelainen.com
Fri Jan 8 07:38:16 PST 2010


BCS wrote:
> Hello Lutger,
> 
>> On 01/07/2010 10:50 PM, Brien wrote:
>>
>>> Don Wrote:
>>>
>>>>> Ok, that's good to know.  I assumed because D billed itself as a
>>>>> "systems" programming language that performance would be paramount.
>>>>>
>>>> He's talking about his converter program, not about D!
>>>>
>>> Oops, sorry about the misinterpretation.
>>>
>>>>> I'm sure I'm the millionth person to ask this, but- is there a
>>>>> language out there that is bare metal like C/C++ with the
>>>>> friendlier syntax and developer productivity of Java/C#?
>>>>>
>>>> D is trying to be exactly that. We don't have the infrastructure
>>>> yet, though. So the productivity gains are a bit theoretical at
>>>> present...
>>>>
>>> Cool.
>>>
>>> That being the case, I'm not sure I can give up my addiction to
>>> Jetbrains Resharper.  Do you think a fully automated translation from
>>> C#->D is possible so that I can continue to primary develop using C#
>>> tools?  I'm not too worried about library support- I can reimplement
>>> whatever I need, just the language itself.
>>>
>>> Also, is the threading support and memory model of D1.0 solid and
>>> performant?  I'm a little unclear about how synchronization is
>>> achieved.  I see the synchronized keyword and I've seen some
>>> references to using mutexes, but I don't really have a clear picture.
>>>
>>> Thanks
>>>
>> Wouldn't it be more efficient for you and the code to implement the
>> performance critical parts as a library in D and use that in C#? D can
>> easily do extern(C) so it's not much work, much less probably than
>> massaging an automated port.
>>
> 
> IIRC managed<->un-managed calls are insanely expensive. If you do 
> this,profile the Snot out of it to be sure you actually get a gain out 
> of it.
> 
> 
Every managed->unmanaged call is checked somehow, and there was an 
attribute which lets you do pinvoke calls extremely fast but unsafe. 
printf perfomance was pretty much the same as in C++ with that 
attribute. Its used internally to do OS calls very fast, iirc it was 
undocumented. Try some disassemblers on .net framework, mainly parts 
that do OS calls.

Good Luck

- data



More information about the Digitalmars-d mailing list