Community
cancel
Showing results for 
Search instead for 
Did you mean: 
softarts
Beginner
34 Views

thingking about packet processing pipeline example

the TBB book shows us an example "packet processing pipeline" which implement with TBB pipeline.
if I understand correctly, the pipeline need to create a new obj(filter) frequently with C++ new primitive, so if the filter has complex data member,it might take a huge time to do that?
0 Kudos
4 Replies
robert-reed
Valued Contributor II
34 Views

Quoting - softarts
the TBB book shows us an example "packet processing pipeline" which implement with TBB pipeline.
if I understand correctly, the pipeline need to create a new obj(filter) frequently with C++ new primitive, so if the filter has complex data member,it might take a huge time to do that?

Typically you'd build the pipeline dynamically as a setup operation and then run that pipeline with enough work to amortize the cost of the pipeline creation. If there are gaps in packet processing that lead to the termination of the pipeline (a null pointer passed along the filter chain), the pipeline should be restartable without having to recreate it.
RafSchietekat
Black Belt
34 Views

If the question is about filter objects specifically: the pipeline does not create, copy or delete them.
softarts
Beginner
34 Views

Quoting - Raf Schietekat
If the question is about filter objects specifically: the pipeline does not create, copy or delete them.

just check the code, should be the 'stage_task ' is created again,
but seems it is related with the task scheduler,not pipeline?
RafSchietekat
Black Belt
34 Views

"just check the code, should be the 'stage_task ' is created again,
but seems it is related with the task scheduler,not pipeline?"
I presume that you meant to write that you "just checked the code", not that I should? In a pipeline you bring your own filter/stage objects, but TBB provides the tasks, and you have no say in what they look like or how they are operated. I would have chosen the name pipeline_task myself (a task stays with an item, not with a filter/stage), but that wouldn't mean that any pipeline objects are being created. :-) A pipeline could also be made to recycle its tasks, as I proposed a while ago in some experimental code, but I didn't measure its outcome.