blog post about how you can make your gc code faster

Vladimir Panteleev thecybershadow.lists at gmail.com
Sat Nov 19 11:50:45 UTC 2022


On Wednesday, 9 November 2022 at 11:55:28 UTC, Guillaume Piolat 
wrote:
> I've been avoiding void[] for this reason (I mean, void[] 
> _could_ contain pointers), but I think I'm cargo-culting this?
>
> If I do:
>     ubyte[] arr = new ubyte[100_000_000];
>     void[] arr2 = cast(void[]) arr; // will this still avoid 
> scanning?
>
> Does the GC still know that this area is NO_SCAN?

Yes (as per Adam's post).

However, it's easy to lose it with operations like concatenation 
or appending. `a ~ b` will allocate `void[]` (without `NO_SCAN`) 
if either are `void[]`. This is why I still use `ubyte[]` (or, in 
ae, `Data` / `DataVec`) for raw data.



More information about the Digitalmars-d-announce mailing list