March 31, 2015 Re: Benchmark of D against other languages | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | 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.
|
March 31, 2015 Re: Benchmark of D against other languages | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ary Borenszweig | On Tuesday, 31 March 2015 at 22:15:58 UTC, Ary Borenszweig wrote:
> But in Crystal he also uses classes and doesn't mark methods as final. And it's faster than D.
>
Not familiar with their way of doing.
Can you explain the crystal semantic ?
|
March 31, 2015 Re: Benchmark of D against other languages | ||||
---|---|---|---|---|
| ||||
Posted in reply to deadalnix | On 3/31/15 7:27 PM, deadalnix wrote: > On Tuesday, 31 March 2015 at 22:15:58 UTC, Ary Borenszweig wrote: >> But in Crystal he also uses classes and doesn't mark methods as final. >> And it's faster than D. >> > > Not familiar with their way of doing. > > Can you explain the crystal semantic ? You can read how method dispatch works here: http://crystal-lang.org/2015/03/04/crystal-0.6.1-released.html#method-dispatch |
March 31, 2015 Re: Benchmark of D against other languages | ||||
---|---|---|---|---|
| ||||
Posted in reply to cym13 | 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
dmd in benchmark => worthless
there really needs to be a big red warning that dmd is just the reference implementation and use LDC/GDC for performance.
|
April 01, 2015 Re: Benchmark of D against other languages | ||||
---|---|---|---|---|
| ||||
Posted in reply to weaselcat | On Tuesday, 31 March 2015 at 23:53:07 UTC, weaselcat 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
>
> dmd in benchmark => worthless
> there really needs to be a big red warning that dmd is just the reference implementation and use LDC/GDC for performance.
all this benchmark made me realize is that other languages and compilers are dog slow.
Removed everything except ruby, crystal, C, CPP, nim, and D(dmd and ldc), and go to save myself time. The rust version the code is for is outdated, so I couldn't do rust.
base64
Crystal
encode: 1333333600, 00:00:01.2094060
decode: 1000000000, 00:00:02.4451890
3.66s, 60.4Mb
Go
encode: 1333333600, 4.6449
decode: 1000000000, 20.7173
25.38s, 94.7Mb
Cpp
encode: 1333333600, 4.54
decode: 1000000000, 3.69
8.31s, 67.5Mb
C
encode: 1333333600, 1.19
decode: 1000000000, 2.58
3.78s, 32.8Mb
D - DMD
encode: 1333333600, 1.911
decode: 1000000000, 6.041
7.96s, 89.5Mb
D - LDC
encode: 1333333600, 1.677
decode: 1000000000, 1.916
3.61s, 53.4Mb
D - GDC
encode: 1333333600, 1.319
decode: 1000000000, 2.065
3.40s, 46.7Mb
Nim
encode: 1368421200, 1.77194
decode: 1000000000, 2.78278
4.56s, 101.9Mb
Ruby
encode: 1333333600, 1.69567271
decode: 1000000000, 1.837302336
3.57s, 130.3Mb
winner: GDC
Crystal
ZYXWVUTSRQPONMLKJIHGFEDCBA
8.02s, 2.1Mb
Go
ZYXWVUTSRQPONMLKJIHGFEDCBA
9.57s, 1.7Mb
Cpp
ZYXWVUTSRQPONMLKJIHGFEDCBA
5.81s, 1.3Mb
D
ZYXWVUTSRQPONMLKJIHGFEDCBA
10.01s, 2.4Mb
D - LDC
ZYXWVUTSRQPONMLKJIHGFEDCBA
6.56s, 9.2Mb
D - GDC
ZYXWVUTSRQPONMLKJIHGFEDCBA
7.40s, 2.4Mb
Nim Gcc
ZYXWVUTSRQPONMLKJIHGFEDCBA
4.68s, 1.5Mb
Nim Clang
ZYXWVUTSRQPONMLKJIHGFEDCBA
3.68s, 1.4Mb
Ruby
40+ seconds at third letter, ctrl-c
winner: nim clang
notes: LDC's memory usage??
json:
test file is missing?
matmul:
Crystal
-143.5
5.88s, 73.1Mb
Go
-143.500167
5.95s, 76.6Mb
C
-143.500167
5.36s, 69.6Mb
D
-143.500167
5.50s, 72.5Mb
LDC
-143.500167
4.97s, 80.9Mb
GDC
-143.500167
4.32s, 74.4Mb
Nim
-143.50017
5.77s, 133.8Mb
Ruby
ctrl-c after a couple minutes
winner: D gdc
LDC flags: -O5 -release -inline -boundscheck=off
GDC flags: -O3 -frelease -finline -fno-bounds-check
posting this knowing that andrei is about to yell at me for not posting this in the reddit thread ;)
|
April 01, 2015 Re: Benchmark of D against other languages | ||||
---|---|---|---|---|
| ||||
Posted in reply to weaselcat | On Wednesday, 1 April 2015 at 02:17:29 UTC, weaselcat wrote:
> ...
forgot to label second test, it's the brainfuck one.
p.s., D loses because of AA slowness.
|
April 01, 2015 Re: Benchmark of D against other languages | ||||
---|---|---|---|---|
| ||||
Posted in reply to weaselcat | On 3/31/15 7:17 PM, weaselcat wrote:
> posting this knowing that andrei is about to yell at me for not posting
> this in the reddit thread ;)
Yep, while reading I had this loaded in my chamber: "Remember that statistically NOBODY is on forum.dlang.org and EVERYBODY is on reddit!" -- Andrei
|
April 01, 2015 Re: Benchmark of D against other languages | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | Andrei Alexandrescu:
> Oh boy all classes with one-liner non-final methods. Manu must be dancing a gig right now :o). -- Andrei
Yes, the right default for D language should be final, because lot of programmers are lazy and they don't add attributes.
Bye,
bearophile
|
April 01, 2015 Re: Benchmark of D against other languages | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu Attachments:
| On Tue, 2015-03-31 at 19:52 -0700, Andrei Alexandrescu via Digitalmars-d wrote: > On 3/31/15 7:17 PM, weaselcat wrote: > > posting this knowing that andrei is about to yell at me for not > > posting > > this in the reddit thread ;) > > Yep, while reading I had this loaded in my chamber: "Remember that statistically NOBODY is on forum.dlang.org and EVERYBODY is on reddit!" -- Andrei Not "everybody". -- Russel. ============================================================================= Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.winder@ekiga.net 41 Buckmaster Road m: +44 7770 465 077 xmpp: russel@winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder |
April 01, 2015 Re: Benchmark of D against other languages | ||||
---|---|---|---|---|
| ||||
Posted in reply to Russel Winder | On 4/1/15 3:06 AM, Russel Winder via Digitalmars-d wrote:
> On Tue, 2015-03-31 at 19:52 -0700, Andrei Alexandrescu via Digitalmars-d wrote:
>> On 3/31/15 7:17 PM, weaselcat wrote:
>>> posting this knowing that andrei is about to yell at me for not
>>> posting
>>> this in the reddit thread ;)
>>
>> Yep, while reading I had this loaded in my chamber: "Remember that
>> statistically NOBODY is on forum.dlang.org and EVERYBODY is on
>> reddit!"
>> -- Andrei
>
> Not "everybody".
"Everybody" compared to "nobody". It's a statistics thing :o). -- Andrei
|
Copyright © 1999-2021 by the D Language Foundation