perf: add proxy cache to avoid the deserialize step (#140)
* perf: add proxy cache to avoid the deserialize step * feat(proxy_plugin): Dynamically register cache serialization types * feat: Optimize the traversal method for type list
This commit is contained in:
parent
aca86a230b
commit
10bb03f458
@ -7,7 +7,7 @@ aimrt:
|
|||||||
- name: ros2_plugin
|
- name: ros2_plugin
|
||||||
path: ./libaimrt_ros2_plugin.so
|
path: ./libaimrt_ros2_plugin.so
|
||||||
options:
|
options:
|
||||||
node_name: example_ros2msg_echo_plugin
|
node_name: example_ros2msg_record_playback_plugin
|
||||||
executor_type: MultiThreaded # SingleThreaded/StaticSingleThreaded/MultiThreaded
|
executor_type: MultiThreaded # SingleThreaded/StaticSingleThreaded/MultiThreaded
|
||||||
executor_thread_num: 2
|
executor_thread_num: 2
|
||||||
- name: record_playback_plugin
|
- name: record_playback_plugin
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
source install/share/example_ros2/local_setup.bash
|
||||||
|
|
||||||
./aimrt_main --cfg_file_path=./cfg/examples_plugins_record_playback_plugin_record_ros2_imd_cfg.yaml
|
./aimrt_main --cfg_file_path=./cfg/examples_plugins_record_playback_plugin_record_ros2_imd_cfg.yaml
|
||||||
|
@ -209,6 +209,11 @@ void ProxyPlugin::RegisterSubChannel() {
|
|||||||
.pkg_path = type_support_wrapper.options.path,
|
.pkg_path = type_support_wrapper.options.path,
|
||||||
.module_name = "core",
|
.module_name = "core",
|
||||||
.msg_type_support_ref = type_support_wrapper.type_support_ref}};
|
.msg_type_support_ref = type_support_wrapper.type_support_ref}};
|
||||||
|
|
||||||
|
for (const auto type_list = type_support_wrapper.type_support_ref.SerializationTypesSupportedListSpan(); const auto& type : type_list) {
|
||||||
|
subscribe_wrapper.require_cache_serialization_types.emplace(type.str);
|
||||||
|
}
|
||||||
|
|
||||||
subscribe_wrapper.callback = [this, action_raw_ptr = proxy_action.get()](
|
subscribe_wrapper.callback = [this, action_raw_ptr = proxy_action.get()](
|
||||||
MsgWrapper& msg_wrapper, std::function<void()>&& release_callback) {
|
MsgWrapper& msg_wrapper, std::function<void()>&& release_callback) {
|
||||||
if (msg_wrapper.msg_ptr == nullptr && msg_wrapper.serialization_cache.size() == 0) [[unlikely]] {
|
if (msg_wrapper.msg_ptr == nullptr && msg_wrapper.serialization_cache.size() == 0) [[unlikely]] {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user