My thought was to use in-place allocation for std::optional<Traceable> and I wondered its feasibility. If we have to allocate, then there seems no advantage compared to Member<GarbageCollected> (thought we need to make Traceable GarbageCollected).
A data point probably related: I tested the Oilpan-PaintProperty with two variants for some heavily used temporary Vectors that serve as stacks:
1. Using (discouraged) UntracedMember in the stack entries, like
struct StackEntry {
UntracedMember<TransformPaintPropertyNode> transform;
...
};
Vector<StackEntry> stack;
...
The UntracedMember should be safe because no paint properties can change during the lifespan of the stacks.
2. Using Member<GarbageCollected> in the stack entries, like
struct StackEntry : public GarbageCollected<StackEntry> {
Member<TransformPaintPropertyNode> transform;
...
};
HeapVector<Member<StackEntry>> stack;
(Actually the CLs also have code using HeapVector<StackEntry as Traceable>, but I didn't test the variant with these vectors.)
The
pinpioint job doesn't show any high-confidence difference between the two variants. It seems that Oilpan's dynamic allocation algorithm is so efficient that the cost is not even measurable in my test.