A proper language comparison...

Peter Alexander peter.alexander.au at gmail.com
Thu Jul 25 13:03:50 PDT 2013


On Thursday, 25 July 2013 at 18:23:19 UTC, Xinok wrote:
> These are the type of comparisons I'd like to see with 
> programming languages. For starters, there should be standard 
> "challenges" (algorithms and such) implemented in each language 
> designed to measure various aspects of the language, such as 
> sorting, number crunching, and string processing. However, 
> rather than leave it to a single individual to implement the 
> algorithm in several different languages, it should be left to 
> the community to collaborate and produce an "ideal" 
> implementation of the algorithm in their language. We could 
> analyze factors other than performance, such as the ease of 
> implementation (how many lines? does it use safe/unsafe 
> features? Was it optimized using unsafe / difficult features?).

The problem is all those last bits:

- Line counts aren't a good measure of anything.
- What's safe and unsafe is very subjective.
- What's difficult is even more subjective.

There's also other variables:

- How idiomatic is the code?
- How well does it scale?
- How much headroom is there for more optimisation?
- How predictable is the performance?
- How well do you need to know the language's implementation to 
do optimisations?

For example, optimised Haskell will often added strict evaluation 
hints, and strict type hints, but these are very non-idiomatic, 
and work against the lazy nature of the language.

D on the other hand does quite well with all these variables: 
idiomatic D code is generally quite fast, and its abstractions 
scale quite well. Performance is predictable and the language has 
plenty of features allowing you to do unsafe things for more 
performance if you so desire.

The problem with measuring all this stuff is that it's very 
subjective, so I don't think there can be any standardised way of 
assessing language performance.


More information about the Digitalmars-d mailing list