Appender and CTFE

Steven Schveighoffer schveiguy at yahoo.com
Thu Mar 3 08:24:30 PST 2011


On Thu, 03 Mar 2011 11:22:00 -0500, spir <denis.spir at gmail.com> wrote:

> On 03/03/2011 05:03 PM, Andrei Alexandrescu wrote:
>> On 3/3/11 8:34 AM, Steven Schveighoffer wrote:
>>> On Thu, 03 Mar 2011 07:41:49 -0500, Trass3r <un at known.com> wrote:
>>>
>>>> replace() doesn't work in CTFE anymore cause it was modified to be
>>>> based on Appender.
>>>> According to klickverbot, other phobos functions share that fate.
>>>>
>>>> I think something should be done about this. Couldn't Appender be
>>>> implemented without using a pointer to a struct?
>>>
>>> Yes, it is something I intend to do. I want to make an (un at safe) scoped
>>> appender which does not use a pImpl, along with a safe appender which
>>> does use pImpl.
>>>
>>> It should be as easy as making the impl struct a public struct.
>>>
>>> -Steve
>>
>> One broader question would be if Appender's optimization is still  
>> needed after
>> Steve's improvements to ~=. What is the current performance gap between  
>> using
>> ~= and Appender?
>
> When I tried to use Appender, it was actually slightly slower than plain  
> ~=. The reason was, IIRC, Appender is only efficient when bits added are  
> simple elements, not mini-arrays to be concatenated (there was a thread  
> about that).  There was also an issue with reserve.

I believe those problems have been resolved.  It was fixed in the latest  
release (2.052)

-Steve


More information about the Digitalmars-d mailing list