Modern C++ Lamentations

Jon Degenhardt jond at noreply.com
Mon Dec 31 21:47:42 UTC 2018


On Monday, 31 December 2018 at 13:20:35 UTC, Atila Neves wrote:
> Blog:
>
> https://atilanevesoncode.wordpress.com/2018/12/31/comparing-pythagorean-triples-in-c-d-and-rust/
>
> Reddit:
>
> https://www.reddit.com/r/programming/comments/ab71ag/comparing_pythagorean_triples_in_c_d_and_rust/
>
>
> Hacker news something something dark side.

LTO often helps optimize range code (and phobos code generally), 
so I tried it out on the variants in your repo. Indeed, the range 
variants improve, but not the others. Still doesn't bring the 
range version into line with other three variants.

Compile lines:
* No LTO:  ldc2 -O2
* LTO:  ldc2 -O2 -flto=thin 
-defaultlib=phobos2-ldc-lto,druntime-ldc-lto

LDC 1.13.0; Macbook Pro, 16GB RAM.

The runtime for simple, lambda, and generator variants came in at 
120ms each for both LTO off and LTO on. The range version was 
1080ms for no LTO, and 780ms with LTO.

I bumped N up to 3000 to see if more differentiation would show 
up. There was some, but overall the results were still very 
consistent with N at 1000.

--Jon



More information about the Digitalmars-d mailing list