On Thursday, 9 June 2016 at 16:47:28 UTC, Kagamin wrote:
On Thursday, 9 June 2016 at 15:16:34 UTC, Wyatt wrote:
The point is this sort of language benchmark should use normal
code. The sort of code that people who've never heard of
Haskell would write.
If it's a "fast" language, "ordinary-looking" code should be
fast. If being fast requires weird circumlocutions that
barely anyone knows, it doesn't matter if experts consider it
best practice.
A language optimized for performance of spontaneous code
written by newbies, who never learned the language and don't
use best practices?
Something like
`void main()
{
// Replace anything that looks like a real
// number with the rounded equivalent.
stdin
.byLine
.map!(l => l.replaceAll!(c => c.hit.round)
(reFloatingPoint))
.each!writeln;
}
`
should be as fast as possible. If we have to tell people that
yes, it is idiomatic D but, if you want speed you should use
for (size_t i = 0 ...) { /*some magic here*/ }
then we are doing something wrong.