Top 5
Don
nospam at nospam.com.au
Mon Oct 13 04:26:14 PDT 2008
Christopher Wright wrote:
> Andrei Alexandrescu wrote:
>> Christopher Wright wrote:
>>> Andrei Alexandrescu wrote:
>>>> Steven Schveighoffer wrote:
>>>>> "Andrei Alexandrescu" wrote
>>>>>>> typeof(d) == char[15]*
>>>>>> just char[15].
>>>>>
>>>>> What is the point of that? Why wouldn't you just say:
>>>>>
>>>>> char[15] d;
>>>>
>>>> Only uniformity. In general Type() creates an instance of Type. Easy!
>>>>
>>>>>> S * pS = allocate!(S)(... optional args ...);
>>>>>
>>>>> Ugh. How many extra 'wrapper' functions are built into the code
>>>>> because of this? I suppose it probably would be inlined.
>>>>
>>>> Performance is not to worry about. allocate does only a call to
>>>> gc.allocate, the requisite initialization, and a cast. The cost of
>>>> call to gc.allocate dwarfs the call overhead even in absence of
>>>> inlining.
>>>
>>> Compile times are something to worry about. I'm quite hesitant to use
>>> templates when there is a reasonable alternative; they tend to
>>> increase compilation times dramatically, even if they're relatively
>>> simple.
>>
>> I think this is a self-sustaining myth. I use many templates but
>> rarely notice a compilation time issue.
>>
>> Andrei
>
> I've noticed a huge difference. However, that was with a largish
> recursive set of templates.
It's the CTFE garbage collection bug. Fix that, and all the problems
should disappear.
More information about the Digitalmars-d
mailing list