{"action":"created","issue":{"url":"https://api.github.com/repos/ros2/rmw_fastrtps/issues/203","repository_url":"https://api.github.com/repos/ros2/rmw_fastrtps","labels_url":"https://api.github.com/repos/ros2/rmw_fastrtps/issues/203/labels{/name}","comments_url":"https://api.github.com/repos/ros2/rmw_fastrtps/issues/203/comments","events_url":"https://api.github.com/repos/ros2/rmw_fastrtps/issues/203/events","html_url":"https://github.com/ros2/rmw_fastrtps/pull/203","id":327612374,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkxMzYyMDc1","number":203,"title":"Static typesupport","user":{"login":"MiguelCompany","id":36661117,"node_id":"MDQ6VXNlcjM2NjYxMTE3","avatar_url":"https://avatars1.githubusercontent.com/u/36661117?v=4","gravatar_id":"","url":"https://api.github.com/users/MiguelCompany","html_url":"https://github.com/MiguelCompany","followers_url":"https://api.github.com/users/MiguelCompany/followers","following_url":"https://api.github.com/users/MiguelCompany/following{/other_user}","gists_url":"https://api.github.com/users/MiguelCompany/gists{/gist_id}","starred_url":"https://api.github.com/users/MiguelCompany/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MiguelCompany/subscriptions","organizations_url":"https://api.github.com/users/MiguelCompany/orgs","repos_url":"https://api.github.com/users/MiguelCompany/repos","events_url":"https://api.github.com/users/MiguelCompany/events{/privacy}","received_events_url":"https://api.github.com/users/MiguelCompany/received_events","type":"User","site_admin":false},"labels":[{"id":339248885,"node_id":"MDU6TGFiZWwzMzkyNDg4ODU=","url":"https://api.github.com/repos/ros2/rmw_fastrtps/labels/in%20progress","name":"in progress","color":"fad8c7","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":29,"created_at":"2018-05-30T07:48:10Z","updated_at":"2018-06-15T19:20:43Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/ros2/rmw_fastrtps/pulls/203","html_url":"https://github.com/ros2/rmw_fastrtps/pull/203","diff_url":"https://github.com/ros2/rmw_fastrtps/pull/203.diff","patch_url":"https://github.com/ros2/rmw_fastrtps/pull/203.patch"},"body":"## Summary\r\n\r\nAt eProsima we are working on static typesupport for rmw_fastrtps. We now have the basic functionality ready for C++, but we still have the following todos:\r\n\r\n- [X] create package rosidl_typesupport_fastrtps_c with support for C (i.e. python)\r\n- [X] refactor to avoid #ifdef RMW_FASTRTPS_CPP_STATIC_TYPESUPPORT\r\n  - [X] create package rmw_fastrtps_shared_cpp with common code\r\n  - [X] create package rmw_fastrtps_dynamic_cpp with dynamic specific (introspection) code\r\n  - [X] leave static specific code only on package rmw_fastrtps_cpp\r\n- [X] pass linters\r\n\r\n## Performance test\r\n\r\nWe have run some performance tests (which code is also in the repo). The test scenario involves two applications:\r\n\r\n- Listener application with subscriber for \"test\" and publisher for \"test_echo\":\r\n  - It will publish on \"test_echo\" anything received on \"test\"\r\n\r\n- Talker application with publisher for \"test\" and subscriber for \"test_echo\":\r\n  - It will publish on \"test\" anything received on \"test_echo\"\r\n  - It will increase a counter when receiving on \"test_echo\"\r\n  - It will show the counter value every 10 seconds\r\n  - It will publish a single message on \"test\" upon startup\r\n\r\nFor each data type we run the test as follows:\r\n- Start the listener\r\n- Start the talker and leave it running for 2 minutes\r\n- Take note of the number of times the message has gone from the talker to the listener and back\r\n\r\n### Performance test results\r\n\r\nDepending on the data type, we see an improvement from 0.15% to 84%. The improvement increases with the size of the message as well as with its complexity (number of fields / nested submessages). \r\n\r\n| Data type                        | master  | static  | improvement |\r\n|----------------------------------|---------|---------|-------------|\r\n| [String](https://github.com/ros2/common_interfaces/blob/master/std_msgs/msg/String.msg) <br/>(\"Hello World\")           | 1145937 | 1148323 | 0,21%       |\r\n| [Array16k](https://github.com/eProsima/rmw_fastrtps/blob/static_typesupport_old_/performance_test_msgs/msg/Array16k.msg) <br/>(16KB static array)                       | 891891  | 913705  | 2,45%       |\r\n| [Array4m](https://github.com/eProsima/rmw_fastrtps/blob/static_typesupport_old_/performance_test_msgs/msg/Array4m.msg) <br/>(4MB static array)                        | 1198    | 1976    | 64,94%      |\r\n| [PointCloud512k](https://github.com/eProsima/rmw_fastrtps/blob/static_typesupport_old_/performance_test_msgs/msg/PointCloud512k.msg) <br/>(512KB static array + [PointField](https://github.com/ros2/common_interfaces/blob/master/sensor_msgs/msg/PointField.msg) [8])                 | 10940   | 13411   | 22,59%      |\r\n| [PointCloud8m](https://github.com/eProsima/rmw_fastrtps/blob/static_typesupport_old_/performance_test_msgs/msg/PointCloud8m.msg) <br/>(8MB static array + [PointField](https://github.com/ros2/common_interfaces/blob/master/sensor_msgs/msg/PointField.msg) [8])                   | 874     | 1611    | 84,32%      |\r\n| [Struct16](https://github.com/eProsima/rmw_fastrtps/blob/static_typesupport_old_/performance_test_msgs/msg/Struct16.msg) <br/>(16 byte fields)                       | 1156054 | 1157837 | 0,15%       |\r\n| [Struct32k](https://github.com/eProsima/rmw_fastrtps/blob/static_typesupport_old_/performance_test_msgs/msg/Struct32k.msg) <br/>(8 [Struct4k](https://github.com/eProsima/rmw_fastrtps/blob/static_typesupport_old_/performance_test_msgs/msg/Struct4k.msg) fields, each with 16 [Struct256](https://github.com/eProsima/rmw_fastrtps/blob/static_typesupport_old_/performance_test_msgs/msg/Struct256.msg) fields, each with 16 [Struct16](https://github.com/eProsima/rmw_fastrtps/blob/static_typesupport_old_/performance_test_msgs/msg/Struct16.msg) fields)                       | 50079   | 67757   | 35,30%      |\r\n| [MultiDOFJointState](https://github.com/ros2/common_interfaces/blob/master/sensor_msgs/msg/MultiDOFJointState.msg) <br/>(seq. of 1024 strings + seq. of 1024 [Transform](https://github.com/ros2/common_interfaces/blob/master/geometry_msgs/msg/Transform.msg) + seq. of 1024 [Twist](https://github.com/ros2/common_interfaces/blob/master/geometry_msgs/msg/Twist.msg) + seq. of 1024 [Wrench](https://github.com/ros2/common_interfaces/blob/master/geometry_msgs/msg/Wrench.msg)) | 27400   | 37763   | 37,82%      |\r\n\r\n## Allocation test\r\n\r\nWe have also run a different test scenario to compare memory allocation and copy. In this scenario (launching the applications with argument -m) there is no echo, just a standard talker and listener, and a fixed number of messages (30) is published once a second 30 times. This way, we know the serialization is done the same number of times.\r\n\r\nWe run the talker and the listener under valgrind tools 'massif' (to compare peak size of heap) and 'callgrind' (to compare number of calls to malloc, realloc, memcpy and such)\r\n\r\n### Allocation test results\r\n\r\nThe results show that peak size of heap is almost the same for both branches. The main improvements are in calls to allocation functions. \r\n\r\nResults show that, on serialization, we are allways saving one call to malloc per message. We are also saving realloc calls depending on the size and complexity of the message (up to 860 per message!). For deserialization, one call to malloc is saved per message.\r\n\r\n<table>\r\n  <thead>\r\n    <tr>\r\n      <th></th>\r\n      <th colspan=2>listener</th>\r\n      <th colspan=3>talker</th>\r\n\t</tr>\r\n\t<tr>\r\n\t  <th>Data type</th>\r\n\t  <th>Heap&nbsp;size diff (KB)</th>\r\n\t  <th>malloc&nbsp;diff (calls&nbsp;per&nbsp;msg)</th>\r\n\t  <th>Heap&nbsp;size diff (KB)</th>\r\n\t  <th>malloc&nbsp;diff (calls&nbsp;per&nbsp;msg)</th>\r\n\t  <th>realloc&nbsp;diff (calls&nbsp;per&nbsp;msg)</th>\r\n\t</tr>\r\n  </thead>\r\n  <tr>\r\n    <th><a href=\"https://github.com/ros2/common_interfaces/blob/master/std_msgs/msg/String.msg\">String</a> (\"Hello World\")</th>\r\n\t<td>0</td>\r\n\t<td>1</td>\r\n\t<td>0</td>\r\n\t<td>1</td>\r\n\t<td>0</td>\r\n  </tr>\r\n  <tr>\r\n    <th><a href=\"https://github.com/eProsima/rmw_fastrtps/blob/static_typesupport_old_/performance_test_msgs/msg/Array16k.msg\">Array16k</a></th>\r\n\t<td>0</td>\r\n\t<td>1</td>\r\n\t<td>0</td>\r\n\t<td>1</td>\r\n\t<td>1</td>\r\n  </tr>\r\n  <tr>\r\n    <th><a href=\"https://github.com/eProsima/rmw_fastrtps/blob/static_typesupport_old_/performance_test_msgs/msg/Array4m.msg\">Array4m</a></th>\r\n\t<td>0</td>\r\n\t<td>1</td>\r\n\t<td>0</td>\r\n\t<td>1</td>\r\n\t<td>1</td>\r\n  </tr>\r\n  <tr>\r\n    <th><a href=\"https://github.com/eProsima/rmw_fastrtps/blob/static_typesupport_old_/performance_test_msgs/msg/PointCloud512k.msg\">PointCloud512k</a></th>\r\n\t<td>0</td>\r\n\t<td>1</td>\r\n\t<td>0</td>\r\n\t<td>1</td>\r\n\t<td>2</td>\r\n  </tr>\r\n  <tr>\r\n    <th><a href=\"https://github.com/eProsima/rmw_fastrtps/blob/static_typesupport_old_/performance_test_msgs/msg/PointCloud8m.msg\">PointCloud8m</a></th>\r\n\t<td>0</td>\r\n\t<td>1</td>\r\n\t<td>0</td>\r\n\t<td>1</td>\r\n\t<td>2</td>\r\n  </tr>\r\n  <tr>\r\n    <th><a href=\"https://github.com/eProsima/rmw_fastrtps/blob/static_typesupport_old_/performance_test_msgs/msg/Struct16.msg\">Struct16</a></th>\r\n\t<td>0</td>\r\n\t<td>1</td>\r\n\t<td>0</td>\r\n\t<td>1</td>\r\n\t<td>0</td>\r\n  </tr>\r\n  <tr>\r\n    <th><a href=\"https://github.com/eProsima/rmw_fastrtps/blob/static_typesupport_old_/performance_test_msgs/msg/Struct32k.msg\">Struct32k</a></th>\r\n\t<td>1740</td>\r\n\t<td>1</td>\r\n\t<td>204</td>\r\n\t<td>1</td>\r\n\t<td>338</td>\r\n  </tr>\r\n  <tr>\r\n    <th><a href=\"https://github.com/ros2/common_interfaces/blob/master/sensor_msgs/msg/MultiDOFJointState.msg\">MultiDOFJointState</a> (1024 joints)</th>\r\n\t<td>102</td>\r\n\t<td>1</td>\r\n\t<td>204</td>\r\n\t<td>1</td>\r\n\t<td>860</td>\r\n  </tr>\r\n</table>\r\n"},"comment":{"url":"https://api.github.com/repos/ros2/rmw_fastrtps/issues/comments/397718417","html_url":"https://github.com/ros2/rmw_fastrtps/pull/203#issuecomment-397718417","issue_url":"https://api.github.com/repos/ros2/rmw_fastrtps/issues/203","id":397718417,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NzcxODQxNw==","user":{"login":"dejanpan","id":17376,"node_id":"MDQ6VXNlcjE3Mzc2","avatar_url":"https://avatars1.githubusercontent.com/u/17376?v=4","gravatar_id":"","url":"https://api.github.com/users/dejanpan","html_url":"https://github.com/dejanpan","followers_url":"https://api.github.com/users/dejanpan/followers","following_url":"https://api.github.com/users/dejanpan/following{/other_user}","gists_url":"https://api.github.com/users/dejanpan/gists{/gist_id}","starred_url":"https://api.github.com/users/dejanpan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dejanpan/subscriptions","organizations_url":"https://api.github.com/users/dejanpan/orgs","repos_url":"https://api.github.com/users/dejanpan/repos","events_url":"https://api.github.com/users/dejanpan/events{/privacy}","received_events_url":"https://api.github.com/users/dejanpan/received_events","type":"User","site_admin":false},"created_at":"2018-06-15T19:20:43Z","updated_at":"2018-06-15T19:20:43Z","author_association":"NONE","body":"@dirk-thomas @miguelcompany are there any other checks, tests, reviews that we need to do on this PR?\r\n\r\nDoes it stand a chance for Bouncy release?"}}
{"actor":{"display_login":"dejanpan"}}