Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 47 additions & 1 deletion dimos/protocol/pubsub/benchmark/testdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def redis_msggen(size: int) -> tuple[str, Any]:
print("Redis not available")


from dimos.protocol.pubsub.rospubsub import ROS_AVAILABLE, RawROS, RawROSTopic
from dimos.protocol.pubsub.rospubsub import ROS_AVAILABLE, DimosROS, RawROS, RawROSTopic, ROSTopic

if ROS_AVAILABLE:
from rclpy.qos import QoSDurabilityPolicy, QoSHistoryPolicy, QoSProfile, QoSReliabilityPolicy
Expand Down Expand Up @@ -267,3 +267,49 @@ def ros_msggen(size: int) -> tuple[RawROSTopic, ROSImage]:
msg_gen=ros_msggen,
)
)

@contextmanager
def dimos_ros_best_effort_pubsub_channel() -> Generator[DimosROS, None, None]:
qos = QoSProfile(
reliability=QoSReliabilityPolicy.BEST_EFFORT,
history=QoSHistoryPolicy.KEEP_LAST,
durability=QoSDurabilityPolicy.VOLATILE,
depth=5000,
)
ros_pubsub = DimosROS(node_name="benchmark_dimos_ros_best_effort", qos=qos)
ros_pubsub.start()
yield ros_pubsub
ros_pubsub.stop()

@contextmanager
def dimos_ros_reliable_pubsub_channel() -> Generator[DimosROS, None, None]:
qos = QoSProfile(
reliability=QoSReliabilityPolicy.RELIABLE,
history=QoSHistoryPolicy.KEEP_LAST,
durability=QoSDurabilityPolicy.VOLATILE,
depth=5000,
)
ros_pubsub = DimosROS(node_name="benchmark_dimos_ros_reliable", qos=qos)
ros_pubsub.start()
yield ros_pubsub
ros_pubsub.stop()

def dimos_ros_msggen(size: int) -> tuple[ROSTopic, Image]:
topic = ROSTopic(topic="/benchmark/dimos_ros", msg_type=Image)
return (topic, make_data_image(size))

# commented to save benchmarking time,
# since reliable and best effort are very similar in performance for local pubsub
# testcases.append(
# Case(
# pubsub_context=dimos_ros_best_effort_pubsub_channel,
# msg_gen=dimos_ros_msggen,
# )
# )

testcases.append(
Case(
pubsub_context=dimos_ros_reliable_pubsub_channel,
msg_gen=dimos_ros_msggen,
)
)
Loading