TypeFunction example creatiing a conversion matrix
Stefan Koch
uplink.coder at gmail.com
Thu Oct 1 09:28:34 UTC 2020
On Thursday, 1 October 2020 at 08:57:12 UTC, Stefan Koch wrote:
>
> At those scales there is no difference in compile time.
> However there is a difference in file size.
>
> Type function version:
>
> stat makeConvMatrix.o
> File: 'makeConvMatrix.o'
> Size: 2876
>
> VS template version
>
> stat makeConvMatrix_tmpl.o
> File: 'makeConvMatrix_tmpl.o'
> Size: 11760
Let me illustrate the user visible diffrence:
type function:
string makeConvMatrix(alias[] types ...) // 0.245 times the size
of template object file
Included symbols (extracted with nm)
0000000000000000 R _D14makeConvMatrix12__ModuleInfoZ
U _d_dso_registry
U __start_minfo
U __stop_minfo
template:
string makeConvMatrix(types ...)() // 4 times the size of
typefunction object file
included symbols (extracted with nm)
U _D12TypeInfo_Aya6__initZ
0000000000000000 R _D14makeConvMatrix12__ModuleInfoZ
0000000000000000 W
_D14makeConvMatrix__TQtTgThTsTtTiTkTlTmZQBmFNaNbNfZAya
U _d_arrayappendT
U _d_dso_registry
U _GLOBAL_OFFSET_TABLE_
U __start_minfo
U __stop_minfo
0000000000000000 r _TMP0
0000000000000002 r _TMP1
0000000000000038 r _TMP10
000000000000003d r _TMP11
0000000000000042 r _TMP12
0000000000000048 r _TMP13
000000000000004e r _TMP14
0000000000000052 r _TMP15
0000000000000059 r _TMP16
000000000000005d r _TMP17
0000000000000062 r _TMP18
0000000000000067 r _TMP19
0000000000000008 r _TMP2
000000000000000f r _TMP3
0000000000000016 r _TMP4
000000000000001e r _TMP5
0000000000000023 r _TMP6
0000000000000029 r _TMP7
000000000000002f r _TMP8
0000000000000036 r _TMP9
More information about the Digitalmars-d
mailing list