D vs. C#

Walter Bright newshound1 at digitalmars.com
Mon Oct 22 15:02:08 PDT 2007


Bruce Adams wrote:
> Walter Bright Wrote:
> 
>> Bruce Adams wrote:
>>> Imagine it as a compatibility layer or a shared library. If my OS
>>>  supports POSIX I can develop for POSIX. If I develop for windows
>>> as well I have to learn and use other APIs. A VM is just a
>>> special kind of API that provides a language backend and
>>> interpreter.
>> It can be thought of that way, it's just entirely unnecessary to
>> achieve those goals, and throws in a bunch of problems:
>> 
>> 1) perennial performance issues
> 
> The difference is what you are optimising the performance of. A
> dynamic language using a VM is optimising the programmers performance
> by allowing them to skip the compilation step at the expense of
> slower code.

I bet D compiles faster to native code <g>. In any case, I was talking 
about performance of apps, not the edit/compile/debug loop.

>> 2) incompatibility and inoperability with native languages
> 
> This is partly by design. A VM operating as a sandbox should not be
> able to go down to the hardware level. However I think good
> interoperability has been demonstrated. Most scripting languages
> sport a way of writing extensions. These must be executed by the VM
> somehow. And then there's SWIG for automating the generation of
> wrappers.

VMs go through some sort of marshalling and compatiblity layer to 
connect to the outside world. Native languages can connect directly.


>> 3) gigantic runtimes needed
> 
> An interpreter itself is relatively small. I can only assume that a
> lot of the bloat is down to bad coding. If you look at games these
> days they weigh in at a ridiculous 4Gb install. No amount of
> uncompressed data for performance gain excuses that. I suspect its
> the same sloppy coding for VMs on a smaller scale. It would not
> surprise me to see much smaller (and more elegantly designed)
> run-times on devices such as PDAs where the bloat cannot be
> tolerated.

The reason the gigantic runtimes are needed is because the VM has to 
carry around with it essentially an entire small operating system's 
worth of libraries. They all have to be there, not just the ones the app 
actually uses. The VM winds up duplicating much of the functionality of 
the underlying OS APIs.

> <asbestos suit> I wonder if the compile time side of D might benefit
> from running inside a VM when people start to do really evil and
> complicated things with it. </asbestos suit>

I don't think D compile times have been a problem <g>.




More information about the Digitalmars-d mailing list