Benchmark of D against other languages
Martin Nowak via Digitalmars-d
digitalmars-d at puremagic.com
Tue Mar 31 14:30:54 PDT 2015
On 03/31/2015 09:07 PM, Andrei Alexandrescu wrote:
> True. I don't have time to put this on my plate, does anyone? -- Andrei
Very little, here is my outcome.
- brainfuck => better backend, better AA
The switch in the run loop doesn't use a switch table.
A lot of time is also spent on AA lookup.
- base64 => Base64.decode could be optimized
It's already quite OK, but a few things could be done better.
- JSON => replace std.json, better AA and GC
std.json is horribly bad + slow AA + slow GC. It got almost 3x faster
with the new GC changes though.
- matmul => need linear algebra library
Can use std.numeric.dotProduct making it 33% faster.
A good linear algebra library could radically improve this.
- havlak => alternative memory management, better AA and GC
Got ~30% faster by the recent GC improvements.
People too often new classes/create arrays like crazy (in loops).
Using alternative memory management schemes is non-obvious or simply
- I'll ask him to use dmd 2.067.0 and add ldc.
- We should finally acknowledge that dmd's backend has no future for
- D's AA is really slow, because of the C-ish interface.
Making AA's a library type is mandatory, but difficult (already failed
thrice). I outlined clear acceptance criteria for a good AA
I currently lean towards adding a new implementation as `AA!(Key,
Value)` while slowly deprecating any semantic of the builtin AA that
can't be supported in a library implementation,
then switching the implementations.
Changing the builtin AA to a library type would break a lot of code,
because of the subtle semantic/attribute differences.
- We have a phobos candidate for a std.json replacement that comes with
a pull parser, we should move it to std.experimental asap.
- The GC can never be fast enough, but we're already working on it.
- Make GC alternatives more prominent, e.g. tell people to favor structs
- Add getOrSet to AA
Simple optimization for a common use-case.
- Use open addressing for AA
Considerable speeds up AA, fairly simple to implement.
Now I spent way more than 1 hour on this ;).
More information about the Digitalmars-d