In roc_pipeline module we have numerous pipelines which construct a chain of smaller building blocks from lower-level modules, for example SenderSink and ReceiverSession.
The chain construction is be performed incrementally and sometimes conditionally. We create the first element, check for errors, then create the second element if it's enabled, and so on.
To achieve this, the pipeline fields are declared of type core::ScopedPtr<T> instead of just T, so that their initialization can be delayed.
The drawback of this approach is that we have lots of small allocations, while technically we could avoid it and perform a single bigger allocation for the whole pipeline object.
So this issue is for cleaning this up a bit. We now have core::Optional<T>, which can be used exactly for the purpose of the delayed initialization, but does not require an unnecessary allocation.
So we should just replace all those core::ScopedPtr<T> fields in roc_pipeline with core::Optional<T>, and adjust the initialization accordingly.
In roc_pipeline module we have numerous pipelines which construct a chain of smaller building blocks from lower-level modules, for example SenderSink and ReceiverSession.
The chain construction is be performed incrementally and sometimes conditionally. We create the first element, check for errors, then create the second element if it's enabled, and so on.
To achieve this, the pipeline fields are declared of type
core::ScopedPtr<T>
instead of justT
, so that their initialization can be delayed.The drawback of this approach is that we have lots of small allocations, while technically we could avoid it and perform a single bigger allocation for the whole pipeline object.
So this issue is for cleaning this up a bit. We now have
core::Optional<T>
, which can be used exactly for the purpose of the delayed initialization, but does not require an unnecessary allocation.So we should just replace all those
core::ScopedPtr<T>
fields in roc_pipeline withcore::Optional<T>
, and adjust the initialization accordingly.