first numbers: type function vs template

Stefan Koch uplink.coder at
Fri Aug 21 22:49:46 UTC 2020

On Friday, 21 August 2020 at 22:05:31 UTC, Per Nordlöw wrote:
> On Friday, 21 August 2020 at 19:13:30 UTC, Stefan Koch wrote:
>> In terms of memory a quick best out of three reveals:
>> 19080k for the template  and
>> 14328k for the type function.
>> Which is a reduction by roughly 25%.
>> I am rather pleased by those numbers, given that type 
>> functions are still very much proof of concept and rather 
>> unoptimized.
> Nice.
> BTW, is newCTFE's latency to high to give further speedups for 
> this type function?

I am not sure.
It would depend on how much your introspection has to do.
And how many types you have to serialize.

newCTFE is an independent virtual machine with it's own ABI.
In order for it to work with types the types would have to be 
serialized and given a binary representation suitable for the VM 
to work with.
Currently I am undecided on how a binary representation would 
Since that depends on what properties I want type functions to be 
able to use.
(type-size, type-members, data-layout, name, mangle, UDAs, 
baseClasses, vtbls, and so on)
I hope that Andrei's work on type info can inform my decision on 
But all that is far in the future.

More information about the Digitalmars-d mailing list