On 3/20/15 12:42 AM, Paulo Pinto wrote:
On Friday, 20 March 2015 at 05:17:11 UTC, Walter Bright wrote:
On 3/19/2015 9:59 AM, "Ola Fosheim =?UTF-8?B?R3LDuHN0YWQi?=
<[email protected]>" wrote:
On Thursday, 19 March 2015 at 00:42:51 UTC, weaselcat wrote:
On Wednesday, 18 March 2015 at 12:59:17 UTC, bearophile wrote:
High level constructs in D are often slower than low-level code, so
in some
cases you don't want to use them.

I actually found that LDC does an _amazing_ job of optimizing high
level
constructs and converting "low level" code to higher level
functional code
resulted in minor speedups in a lot of cases.


(Other performance benefits include the algorithm primitives being
extensively
optimized in phobos.)

If the code/compiler generates suboptimal code in the first place then
improvements can be somewhat random. But if you write code with good
cache
locality, filling the pipeline properly then there is no alternative
to going
low level.

Btw, take a look at this:
http://stackoverflow.com/questions/28922323/improving-line-wise-i-o-operations-in-d


That's really bad marketing...

Sigh. The Python version:
-----------
import sys

if __name__ == "__main__":
    if (len(sys.argv) < 2):
        sys.exit()
    infile = open(sys.argv[1])
    linect = 0
    for line in infile:
        linect += 1
    print "There are %d lines" % linect
----------
does not allocate memory. The splitLines() version:
[...] cutted

Of course it does allocate memory.

Yah, and uses reference counting for management. -- Andrei

Reply via email to