Benchmark of D against other languages

Ary Borenszweig via Digitalmars-d digitalmars-d at puremagic.com
Tue Mar 31 15:15:57 PDT 2015


On 3/31/15 3:44 PM, Andrei Alexandrescu wrote:
> On 3/31/15 11:35 AM, cym13 wrote:
>> On Tuesday, 31 March 2015 at 18:32:25 UTC, Meta wrote:
>>> On Tuesday, 31 March 2015 at 18:20:05 UTC, cym13 wrote:
>>>> I found this repository (reddit!) that hosts common benchmarks for
>>>> many languages such as D, Nim, Go, python, C, etc... It uses only
>>>> standard structures not to influence the benchmark.
>>>>
>>>> https://github.com/kostya/benchmarks
>>>
>>> Can you provide the Reddit link? Right off on the Brainfuck example,
>>> the author used a class instead of a struct, and none of the methods
>>> were marked final.
>>
>> Here it is:
>>
>> http://www.reddit.com/r/programming/comments/30y9mk
>>
>> I don't think the author is an experienced D programmer, but that's
>> maybe why I find it interesting. That shows what a new naïve user can
>> expect as a first result.
>
> Oh boy all classes with one-liner non-final methods. Manu must be
> dancing a gig right now :o). -- Andrei

But in Crystal he also uses classes and doesn't mark methods as final. 
And it's faster than D.

This is not to start a war, maybe one day I'll have to use D in my 
workplace so it better be nice and fast (so it's better if all tools are 
good).

At least in this case, the compiler should detect that the class isn't 
inherited and that you are creating an executable out of the program, so 
it's can't be a library, and mark the methods as final. And with escape 
analysis (something that Crystal also lacks, but other languages have) 
the compiler could figure out that the class doesn't need to be 
allocated on the heap.

In short, I think we need smarter compiler, not more keywords to 
optimize our code.


More information about the Digitalmars-d mailing list