On 2015-07-27 14:03, Johan Holmberg via Digitalmars-d wrote:
Back on MacOS again, I thought I should try to run "Instruments" on my program. I'm not familiar with the DMD source code, but I did the following: - downloaded the DMD source from Github + built it - rebuilt my program with this dmd - used Instruments (the MacOS profiler) on my program Two things showed up in Instruments that seemed suspicious, both in "stdio.d": 1) calls to "__tls_get_addr" inside readlnImpl" (taking 0.25s out of the total 1.69s according to Instruments). I added "__gshared" to the static variables "lineptr" and "n" to see if it had any effect (see below for results). 2) calls to "std.algorithm.endsWith" inside File.ByLine.Impl.popFront (taking 0.10s according to Intruments). I replaced it with a simpler test using inline code. The timings running my program normally (not using Instruments now), became as follows with the different versions of dmd: dmd unmodified: 1.59s dmd with change 1): 1.33s dmd with change 1+2): 1.22s C++ using <stdio.h>: 1.13s (for comparison)
I recommend you also try using LDC. It has a better optimizer and is using native TLS on OS X.
-- /Jacob Carlborg
