Question to GC experts: NO_SCAN for a part of the block
Stanislav Blinov via Digitalmars-d
digitalmars-d at puremagic.com
Tue Jun 6 05:34:03 PDT 2017
On Tuesday, 6 June 2017 at 12:07:28 UTC, Steven Schveighoffer
wrote:
> On 6/6/17 6:36 AM, Stanislav Blinov wrote:
>> On Tuesday, 6 June 2017 at 09:57:31 UTC, Steven Schveighoffer
>> wrote:
>>
>>> No, 2 allocations instead of N.
>>
>> Oh, I misunderstood you. You mean two blocks total, for
>> scanned and
>> non-scanned data. This could indeed work for cases when more
>> than two
>> arrays are needed. Still, it's one extra allocation.
>>
>
> True. But O(2) is better than O(N) :)
>
> -Steve
Heh, this isn't malloc. We could end up in a situation when even
one allocation is slower than N, depending on when they happen :)
Actually, separate blocks might be a decent choice: there's
another problem with sharing blocks for different data in that
finalizers can't be run. So such a function would either not
support types with finalizers at all, or would have to allocate
separate blocks for such types anyway. Don't know, need to
actually implement and measure if it's even worth the trouble.
More information about the Digitalmars-d
mailing list