[ros-users] Cost of publishing when nobody's subscribing

Patrick Mihelich mihelich at willowgarage.com
Tue Dec 7 07:37:12 UTC 2010


For normal ros::Publishers also, there's some "has subscribers" check before
doing anything expensive like serialization. Of course, if constructing the
message in the first place is significantly expensive, it's a good idea to
check if there are subscribers for it.

Cheers,
Patrick

On Mon, Dec 6, 2010 at 8:45 AM, Nicholas Butko <nbutko at ucsd.edu> wrote:

> Thanks, Cedric.
> --Nick
>
> On Dec 6, 2010, at 8:26 AM, Cedric Pradalier wrote:
>
> > Hi Nick,
> >
> > As far as I know, the publish operation for image transport are in a "if
> > (numSubscriber() > 0) { ... publish ...} " block.
> > If there is no subscriber, the serialisation code should  not be  called
> > at all, so the cost should be very close to 3.
> >
> > On 12/06/10 17:19, Nicholas Butko wrote:
> >> Does anyone familiar with the details of roscpp or imae_transport know,
> specifically in the context of no subscribers, (a) how much overhead is
> there to publish something? and (b) does that overhead scale with the size
> of the message?
> >>
> >> Specifically I am interested in the case of images. Consider three
> cases:
> >>
> >> 1) a node publishes an image, and it is shown in image_view
> >> 2) a node publishes an image, but it is not shown in image_view or
> anywhere else
> >> 3) a node does not publish an image
> >>
> >> Clearly there will be a lot more computation associated with (1) than
> (3), but what about (2) -- is it closer to (1) or (3) or somewhere close to
> the middle?
> >>
> >> --Nick
> >> _______________________________________________
> >> ros-users mailing list
> >> ros-users at code.ros.org
> >> https://code.ros.org/mailman/listinfo/ros-users
> >>
> >
> > --
> > Dr. Cedric Pradalier
> > http://www.asl.ethz.ch/people/cedricp
> >
> > _______________________________________________
> > ros-users mailing list
> > ros-users at code.ros.org
> > https://code.ros.org/mailman/listinfo/ros-users
>
> _______________________________________________
> ros-users mailing list
> ros-users at code.ros.org
> https://code.ros.org/mailman/listinfo/ros-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ros.org/pipermail/ros-users/attachments/20101206/7cecdbcc/attachment-0003.html>


More information about the ros-users mailing list