5 ms·
Updated benchmark: capnproto-rust vs. c++
- benth 13y agoFor the "catrank" case, could you use std::str::raw::from_utf8 to skip the utf-8 validity check?
- steveklabnik 13y agoI wonder if it'd be instructive to have a Ruby or Python benchmark too, just to show how much you gain by using a lower-level language.
- dwrensha 13y agoSee this thread on the Cap'n Proto mailing list for some idea of how well Python does on this benchmark: https://groups.google.com/forum/#!topic/capnproto/BDpV6WEG5Bw https://groups.google.com/forum/#!topic/capnproto/BDpV6WEG5B...
- steveklabnik 13y agoThank you!
- cma 13y agoKeep in mind pycapnp is a wrapper of the c++ lib, so you aren't seeing all of the lower-level language gains in the comparison.
- jparyani 13y agoAuthor of pycapnp here. For those too lazy to click through, pycapnp is tremendously slower than C++/Rust. The equivalent benchmarks take about 20-50x as long. What's more interesting to me is comparing it to other Python serialization libraries. I've been meaning to update the benchmarks with some popular ones (msgpack, thrift, and the built-in json module are at the top of my list). If there's some interest, I'll go ahead and post it to HN when I'm done.
- westernmostcoy 13y agoI'd certainly be interested!
- thinkpad20 13y agoCurious, how feasible would it be to simply call into existing C/C++ libraries from python instead of writing it in pure python?
- dwrensha 13y agoPycapnp is not pure Python. It wraps Cap'n Proto's C++ dynamic API. See http://kentonv.github.io/capnproto/otherlang.html#supporting_dynamic_languages http://kentonv.github.io/capnproto/otherlang.html#supporting... .
- ksec 13y agoLove that. I am still hoping for a Ruby Implementation in Rust once Rust hit 1.0
- samnardoni 13y agoWhy? (Genuinely curious...)
- pjmlp 13y ago> I wonder if it'd be instructive to have a Ruby or Python benchmark too, just to show how much you gain by using a lower-level language. It depends which implementation get compared. If the standard implementations get used, that any strong typed language with ahead of time compilation to native code will win hands down. Now if RubyMotion or PyPy are part of the benchmark, maybe they can achieve good enough performance.
- codygman 13y agoI wish we could compare the old Haskell version to the C++ and Rust versions as well.
- dwrensha 13y agoYou're probably thinking of the original version of Cap'n Proto's schema parser, which was written in Haskell. The code generation step that it helped to handle is not a part of this benchmark. As far as I know, nobody has written a Cap'n Proto serialization runtime for Haskell yet. See http://kentonv.github.io/capnproto/otherlang.html http://kentonv.github.io/capnproto/otherlang.html .
- pjmlp 13y agoQuite good results, given that Rust is still quite a young language.
- annnnd 13y agoAgreed. Also, less (/no?) memory related bugs counts for something too.
- rjzzleep 13y agoi'd be surprised if there wasn't a decent amount of bugs still in the standard library
- dbaupp 13y agoThere's probably not too many memory safety bugs in the standard library, most of it is "safe" code (i.e. Rust code without any `unsafe`). (That said, there probably are some `unsafe` blocks that were not written with enough care, etc.)