[GSoC] 'Replace Runtime Hooks with Templates' progress and update thread
Mike Franklin
slavo5150 at yahoo.com
Fri May 31 05:20:02 UTC 2019
On Thursday, 30 May 2019 at 16:45:12 UTC, H. S. Teoh wrote:
> On Thu, May 30, 2019 at 12:15:55PM +0000, Johannes Pfau via
> There's also the issue of code bloat, which should at least be
> considered
Yes, it is something to be mindful of. There are a couple of
things that can be done to mitigate that risk.
One would be to factor out the parts of the implementation that
are not type-dependent into their own functions. Those
implementations would then be shared by the type-dependent
implementations, reducing the potential for bloat.
There is also a role for the compiler/linker to play. As a
contrived example:
T xor(T)(T a, T b)
{
return a ^ b;
}
int x;
int y;
int z = xor!int(x, y);
uint a;
uint b;
uint c = xor!uint(a, b);
The compiler/linker should be able to recognize that the
`xor!int` and `xor!uint` are identical, and only one should end
up the resulting binary.
Mike
More information about the Digitalmars-d
mailing list