gdc or ldc for faster programs?

Ali Çehreli acehreli at yahoo.com
Wed Jan 26 15:37:39 UTC 2022


On 1/26/22 04:06, Johan wrote:

 > The stdlib makes a huge difference in performance.
 > Ali's program uses string manipulation,

Yes, on the surface, I thought my inner loop had just / and % but of 
course there is that formattedWrite. I will change the code to use 
sprintf into a static buffer (instead of the current Appender).

 > GC

That shouldn't affect it because there are just about 8 allocations to 
be shared in the Appender.

 > , ... much more than to()

Not in the 2 million loop.

 > and
 > map().

Only in the initialization.

 > Quick test on my M1 macbook:
 > LDC1.27, arm64 binary (native): ~0.83s
 > LDC1.21, x86_64 binary (rosetta, not native to CPU instruction set): 
~0.75s

I think std.format gained abilities over the years. I will report back.

Ali



More information about the Digitalmars-d-learn mailing list