0 cost template instantiation
Hipreme
msnmancini at hotmail.com
Thu Sep 30 03:41:34 UTC 2021
On Thursday, 30 September 2021 at 03:21:51 UTC, jfondren wrote:
> On Thursday, 30 September 2021 at 03:13:28 UTC, jfondren wrote:
>> As provided, loadSymbol without the "static if":
>>
>> 965K libhipengine_api.a
>>
>> with `mixin(loadSymbol("name"))` instead of a template:
>>
>> 749K libhipengine_api.a
>
> The difference goes down to 66K vs. 60K with `dub -brelease
> --compiler=gdc`. ldc's not as slim but still much better than
> dmd, and -brelease is actually much less significant. So dmd's
> the main culprit for the bloat here. huh.
>
> But since you have importPaths-ldc perhaps you weren't using
> dmd to begin with.
Yup. The mixin(loadSymbol("")) seems the best way to do.
I believe that should be the option for loading separated symbols
while loadSymbols version is the best for loading a lot of
symbols(IDK how expensive is mixing a lot of functions) as it
costs 1KB per instantiation.
I'm actually using DMD and LDC, dmd compiles a bit faster, but I
use ldc for deploying it. Never used GDC.
More information about the Digitalmars-d-learn
mailing list