Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improving the performance of the read_message by not splitting the da… #90

Conversation

P3TE
Copy link
Contributor

@P3TE P3TE commented Aug 25, 2021

Improving the performance read_message, see #89

This is done by receiving the entire message all at once instead of reading 1024 byte chunks and stitching them together as you go.

Proposed change(s)

Describe the changes made in this PR.

Useful links (GitHub issues, JIRA tickets, forum threads, etc.)

Provide any relevant links here.

Types of change(s)

  • Performance Enhancement

Testing and Verification

Test machine: i7 9700k, 32Gb ddr4 2133MHz ram.
So before the change, it took between 3.5ms and 4.9ms to read a message of length 2764858 byes (24-bit 720p uncompressed image message)
After the change, it took between 0.5ms and 1.1ms.
Nice.

Test Configuration:

  • Unity Version: [e.g. Unity 2021.1.14f1]
  • Unity machine OS + version: [e.g. Ubuntu 18.04]
  • ROS machine OS + version: [e.g. Ubuntu 18.04, ROS Melodic]

Checklist

  • Ensured this PR is up-to-date with the dev branch
  • Created this PR to target the dev branch
  • Followed the style guidelines as described in the Contribution Guidelines
  • Added tests that prove my fix is effective or that my feature works
  • Updated the Changelog and described changes in the Unreleased section
  • Updated the documentation as appropriate

Other comments

…ta into 1024 chunks and stitching them together as you go, instead receiving the entire message all at once.
Copy link
Contributor

@LaurieCheers-unity LaurieCheers-unity left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome. Why were we even doing all that? 😂

@mrpropellers mrpropellers merged commit 2620cfd into Unity-Technologies:dev Sep 2, 2021
LaurieCheers-unity added a commit that referenced this pull request Sep 29, 2021
* Merge Dev to main for release 0.4.0 (#74)

* Add logging dependency (#32)

* Changing yamato host flavor to large (#33)

* Amanda/read chunks (#36)

* s.send to s.sendall

* Increase default timeout

* Timeout as argument on instantiation

* Update version number (#38)

* Laurie/topic list (#41)

* Updating Contribution Content (#44)

* Contributing guidelines

* Issue templates

* PR feedback

* Updated per later changes (#45)

* Adding PR template (#46)

* One persistent connection for all messages sent to Unity

* make UnityService accessible from ros_tcp_endpoint (#49)

* Don't keep retrying on success (#50)

* Resolve conflicts for merging dev to main

* Queue module was renamed in Python 3 (#53)

* Update package.xml (#54)

* RosConnection 2.0 (#57)

* Remove outdated handshake references

* Fix sending response to unity service (#59)

* add changelog (#60)

* Forum links to README, config.yml (#61)

* Send empty message on connection start (#58)

* add test coverage for python scripts (#62)

* fix the bug (#64)

* Minor bug fixes (#65)

* Add Tests and Linter (#63)

* Add tests for tcp sender

* Add linter and pre-commit hooks

* Reformat with python black

* Add tests

* Add tests for server, client, publisher, subscriber, ros_service, unity_service, thread_pauser

* Fix pre-commit-config file name; Add client tests

* Add github workflow check

* Formatting

* Resolve conflicts (#66)

* Fix bug (#68)

* Fix bug

* Temporarily remove publisher test

Co-authored-by: Shuo Diao <[email protected]>

* update version to 0.4.0 (#69)

Co-authored-by: Devin Miller (Unity) <[email protected]>
Co-authored-by: Amanda <[email protected]>
Co-authored-by: LaurieCheers-unity <[email protected]>
Co-authored-by: Hamid Younesy <[email protected]>
Co-authored-by: peifeng-unity <[email protected]>

* ROS2 support (#77)

Co-authored-by: Tiffany Yau <[email protected]>

* update changelog (#83)

* Merge v0.5.0 (#84)

* Merge main to dev (#85)

* Stale issue handler (#87)

* Initial commit: stale handler

* Remove latest tag from yamato config

* Updated dates, changelog

* PR Feedback: cron schedule

* Exposing publisher queue_size and latch (#88)

* Working to improve the ROS TCP connector by adding queues and latching.

* Exposing the latch parameter for ROS publishers.

* Updating the CHANGELOG

* Improving style for publish method definition.

* Improving the performance of the read_message by not splitting the da… (#90)

* Improving the performance of the read_message by not splitting the data into 1024 chunks and stitching them together as you go, instead receiving the entire message all at once.

* Updating the changelog

* Publisher signature

* Publisher constructor

* Don't mess around with packets, just read the whole message

* source_destination_dict shatters into 4 separate tables

* Update tests

* 1 more test fix

* Updated server, setup dir

Co-authored-by: Shuo Diao <[email protected]>
Co-authored-by: Devin Miller (Unity) <[email protected]>
Co-authored-by: LaurieCheers-unity <[email protected]>
Co-authored-by: Hamid Younesy <[email protected]>
Co-authored-by: peifeng-unity <[email protected]>
Co-authored-by: Tiffany Yau <[email protected]>
Co-authored-by: Peter Smith <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants