Faster Dlang Execution

Basile B. b2.temp at gmx.com
Tue Jun 8 17:40:19 UTC 2021


On Tuesday, 8 June 2021 at 17:10:47 UTC, seany wrote:
> Hello
>
> How can I increase the speed of executable files created via :
>
> `dub build -b release`
>

try `dub build -b release --compiler=ldc2`

Then you can set some specific DFlags for ldc, like -O3 or --mcpu

> I am unable to parallellise all of it, as it depends on part of 
> the result being calculated before something else can be 
> calculated.
>
> I have many `nonsafe, nonpure` functions.

`nothrow` presumably opens optimisation opportunities with the 
stack management, although it's not verified

>Classes are virtual  by defalut.

set them final when possible. When not possible set the virtual 
methods that
are not overridden `final`.

> Profiling doesn't help, because different input is causing 
> different parts of the program to become slow.

if you're on linux, you can try callgrind + kcachegrind instead 
of builtin intrumentation.

> Thank you.




More information about the Digitalmars-d-learn mailing list