Thoughts about D

Iain Buclaw ibuclaw at gdcproject.org
Sat Dec 2 12:13:05 UTC 2017


On 29 November 2017 at 03:18, Walter Bright via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
> On 11/28/2017 9:27 AM, Jacob Carlborg wrote:
>>
>> Why would druntime be a barrier for you for those projects?
>
>
> When the C version is 90K and the translated D version is 1200K, it is a
> barrier. It's a barrier for others, as well.
>

Did you add an extra 0 here for the D version?

> Another barrier for me has turned out to be the way assert() works in D. It
> just is not lightweight, and it visibly slows down dmd to have assert's
> turned on internally. The amount of machinery involved with it in druntime
> is way overblown. Hence, asserts in dmd are turned off, and that wound up
> causing me a lot of problems recently. There are even initiatives to add
> writefln like formatting to asserts. With betterC, asserts became
> lightweight and simple again.
>

I find this assertion hard to believe (pun not intended).  Unless you
are omitting some extra check (invariant calls?), whether you are
using D's assert or C's assert, both have the same runtime cost.

> Andrei's been directing some work on using templates more in druntime to
> reduce this, such as Lucia's work. Martin has done some work with array ops,
> too.
>
> Exception handling support has been a bloat problem, too. DMC++ is built
> with all exceptions turned off. I've been writing PRs for dmd to greatly
> improve things so that it can generate similar code for RAII. (Exceptions
> require druntime.)
>
> BetterC is a door-opener for an awful lot of areas D has been excluded from,
> and requiring druntime is a barrier for that.

It's not a door opener, and druntime is not a barrier.


More information about the Digitalmars-d mailing list