Optimizations and performance
Seb via Digitalmars-d
digitalmars-d at puremagic.com
Wed Jun 8 17:25:28 PDT 2016
On Wednesday, 8 June 2016 at 22:32:49 UTC, Ola Fosheim Grøstad
wrote:
> On Wednesday, 8 June 2016 at 22:19:47 UTC, Bauss wrote:
>> D definitely needs some optimizations, I mean look at its
>> benchmarks compared to other languages:
>> https://github.com/kostya/benchmarks
>>
>> I believe the first step towards better performance would be
>> identifying the specific areas that are slow.
>>
>> I definitely believe D could do much better than what's shown.
>>
>> Let's find D's performance weaknesses and crack them down.
>
> I wouldn't put too much emphasis on that benchmark as the
> implementations appear different? Note that Felix compiles to
> C++, yet beats C++ in the same test? Yes, Felix claims to do
> some high level optimizations, but doesn't that just tell us
> that the C++ code tested wasn't optimal?
While I appreciate that someone puts the time and effort in such
benchmarks, what do they really say?
In the brainfuck example the most expensive function call is the
hash function, which is not needed at all!
We can just allocate an array on demand and we beat the Cpp
implemention by the factor of 2! (and use less memory).
https://github.com/kostya/benchmarks/pull/87
(n.b. that this small change makes D by far the fastest for this
benchmark)
So what do we learn?
1) Don't trust benchmarks!
2) D's dictionary hashing should be improved
More information about the Digitalmars-d
mailing list