template statistics

Basile B. b2.temp at gmx.com
Wed Jun 3 03:06:37 UTC 2020


On Wednesday, 3 June 2020 at 02:32:54 UTC, Walter Bright wrote:
> On 6/2/2020 5:53 AM, Ethan wrote:
>> Oh I have *got* to try this out on my code.
>
> I tried it on `writeln("hello");` and the number of templates 
> instantiated seems excessive. It should be investigated.
>
>   Number   Unique   Name
>       46       38   MAKEINTRESOURCE_T(ushort i)
>       38        0   OldAlias(T) if (!isAggregateType!T || 
> is(Unqual!T == T))
>        7        6   staticIndexOf(T, TList...)
>        1        1   Impl(T)
>        7        5   isSomeChar(T)
>        2        1   StringTypeOf(T)
>        1        1   Impl(T)
>        8        2   mostNegative(T) if (isNumeric!T || 
> isSomeChar!T || isBoolean!T)
>        1        1   encode(Flag useReplacementDchar = 
> No.useReplacementDchar)(out char[4] buf, dchar c)
>        7        7   ModifyTypePreservingTQ(alias Modifier, T)
>        2        1   Unqual(T)
>        1        1   put(A)(A writeme) if 
> ((isSomeChar!(Unqual!(ElementType!A)) || is(ElementType!A : 
> const(ubyte))) && i
> sInputRange!A && !isInfinite!A)
>        1        1   decodeImpl(bool canIndex, Flag 
> useReplacementDchar = No.useReplacementDchar, S)(auto ref S 
> str, ref
> size_t index) if (is(S : const(char[])) || isInputRange!S && 
> is(Unqual!(ElementEncodingType!S) == char))
>        3        1   isCallable(T...) if (T.length == 1)
>        1        1   trustedFwrite(T)(FILE* f, const T[] obj)
>        2        1   _utfException(Flag 
> useReplacementDchar)(string msg, dchar c)
>        1        1   popFront(C)(ref C[] str) if (Autodecoding 
> && isNarrowString!(C[]))
>        2        2   IntegralTypeOf(T)
>        1        1   Impl(T)
>        1        1   Impl(T)
>       20       20   genericIndexOf(args...) if (args.length >= 
> 1)
>        1        1   safeOp(T0, T1)(auto ref T0 a, auto ref T1 b)
>        5        1   ElementEncodingType(R)
>        1        1   errnoEnforce(T, string file = __FILE__, 
> uint line = __LINE__)(T value, lazy string msg = null)
>        1        1   Impl(T)
>        2        2   put(C)(C c) if (isSomeChar!C || is(C : 
> const(ubyte)))
>        2        1   exception(S)(S str, string msg)
>        6        1   isNarrowString(T)
>        2        1   at(R)(R[] r, size_t i)
>        1        1   FunctionTypeOf(func...) if (func.length == 
> 1 && isCallable!func)
>        1        1   MinType(T...) if (T.length >= 1)
>        5        0   AliasSeq(TList...)
>        4        1   opDispatch(string name)
>        1        1   min(T...)(T args) if (T.length >= 2)
>        8        8   sndAlias(char c0, char c1)
>        1        1   __equals(T1, T2)(T1[] lhs, T2[] rhs)
>       55       13   isAggregateType(T)
>        8        2   isNumeric(T)
>        7        7   OriginalType(T)
>        4        1   isInputRange(R)
>        1        1   empty(T)(in T[] a)
>        6        3   ElementType(R)
>       36       11   expectType(T)
>       24        7   Unqual(T)
>        1        1   MAKEINTATOM_T()(int i)
>        1        1   writeln(T...)(T args)
>        1        1   Impl(T)
>        3        1   isSomeString(T)
>        1        1   isSomeFunction(T...) if (T.length == 1)
>       15        2   TypeDef(T)
>        1        1   isInfinite(R)
>        3        1   isStaticArray(T)
>       18       18   isSame(ab...) if (ab.length == 2)
>        2        1   front(T)(T[] a) if (Autodecoding && 
> isNarrowString!(T[]))
>        1        1   decode(Flag useReplacementDchar = 
> No.useReplacementDchar, S)(auto ref S str, ref size_t index) if 
> (i
> sSomeString!S)
>        1        1   codeUnitLimit(S) if 
> (isSomeChar!(ElementEncodingType!S))
>        2        1   Parameters(func...) if (func.length == 1 && 
> isCallable!func)
>        1        1   fd_set_custom(uint SETSIZE)
>        4        4   mmioFOURCC(char c0, char c1, char c2, char 
> c3)
>        2        1   Demangle(T)
>        4        3   Flag(string name)
>        1        1   safeOp(string S) if (S == "<" || S == ">" 
> || S == "<=" || S == ">=" || S == "==" || S == "!=")
>        2        2   isIntegral(T)
>        1        1   Impl(T)
>        5        5   CharTypeOf(T)

looks like abstractions are not zero cost in fine


More information about the Digitalmars-d mailing list