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

Add support for CBOR encoding #303

Merged
merged 5 commits into from Dec 5, 2018
Merged

Conversation

mvollrath
Copy link
Contributor

@mvollrath
Copy link
Contributor Author

I intend to add some tests this week.

Copy link
Member

@viktorku viktorku left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution! I was unaware of this CBOR compression method and can't wait to stress test it ;)

This PR seems to have lots of changes which are scattered among the built file and in the modules. Hence it's difficult to review and evaluate the impact on existing code vs clearly separated new code.

Relevant changes should appear only in the individual modules, and a final single "build" commit should produce the minified and non-minified file for CDN purposes. Sorry for this confusion, we need to stop hosting the build folder contents altogether.

build/roslib.js Outdated

})(this);

},{}],2:[function(require,module,exports){
Copy link
Member

Choose a reason for hiding this comment

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

This chunk of code should not appear solely in this file, roslib.js is the result of all packed non-minified modules in the repo.

@mvollrath
Copy link
Contributor Author

Are you saying I should remove all changes to build/ from this PR?

@viktorku
Copy link
Member

viktorku commented Nov 5, 2018

Are you saying I should remove all changes to build/ from this PR?

Yes, the build directory is not supposed to have any manual changes - that's the result of packing all modules in src. You can freely add new modules where they seem appropriate, in core and/or util in your case mostly I think.

@mvollrath
Copy link
Contributor Author

Added my tests and removed the build cruft.

@jihoonl
Copy link
Member

jihoonl commented Nov 6, 2018

We might want to remove build directory at some point as we have seen this minified version drags some PRs down. Not in this PR tho..

@viktorku viktorku requested a review from jihoonl December 4, 2018 12:55
@jihoonl jihoonl merged commit 41297f4 into RobotWebTools:develop Dec 5, 2018
@subvertallchris
Copy link

I know I'm coming in here way late but just felt obligated to say that I really don't love the idea of adding a dependency (cbor-js) that hasn't been updated or seen a closed issue since 2016 and has benchmarks to indicate that it's significantly slower than JSON.

I'm not suggesting that this be immediately removed if people are using it but I'd love to know what kind of adoption it really has. In the meantime, is it worth considering some kind of plugin system that would let someone opt in to this or other libraries like it?

@mvollrath
Copy link
Contributor Author

I know I'm coming in here way late but just felt obligated to say that I really don't love the idea of adding a dependency (cbor-js) that hasn't been updated or seen a closed issue since 2016 and has benchmarks to indicate that it's significantly slower than JSON.

If you have a favorite CBOR library, feel free to drop it in. I tried all of them and decided to use this one. CBOR is still a new protocol and I expect by the time there is a maintenance problem with this library a better one will be available.

The performance difference depends a lot on what kind of data is being deserialized, for all the types of data this patch was intended to optimize (large numeric arrays and untyped binary data e.g. PointCloud2 buffers) CBOR is significantly faster than JSON and its output (typed arrays) is more useful. This difference is described in the rosbridge documentation. This is why CBOR is not the default encoding for rosbridge.

@subvertallchris
Copy link

subvertallchris commented Feb 10, 2020 via email

@mvollrath
Copy link
Contributor Author

I was interested in making rosbridge fast enough so that people can send all types of data over it instead of having to develop special socket servers or republishers for things like point clouds. The people using it seem to be happy with it. I'd rather not make things more complicated for them unless there's a really good reason for it. From where I'm sitting, the CBOR feature only makes up about 10% of the total LoC&C for this client project. The runtime footprint is one if condition per message if you never invoke it. That doesn't seem like a significant burden for anybody, considering what it does for people who need it.

@subvertallchris
Copy link

I hear what you're saying. I apologize if this comes off as rude or dismissive of your interest in pushing things forward because I totally respect the work that went into all of this. I just think that it's worth being sensitive about which dependencies make it into a project and why they're added, especially if new dependencies are on unmaintained libraries. I'm not suggesting we roll back the clock and pull this out -- the ship has sailed on that. I was only chiming in so this could be considered for future PRs.

k-aguete pushed a commit to k-aguete/roslibjs that referenced this pull request Oct 21, 2022
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.

None yet

4 participants