Hacker Newsnew | past | comments | ask | show | jobs | submit | renshaw's commentslogin

I'm with you, in favor of strongly typed headers. Working with strings can be very error-prone; you might not catch typo bugs until your system is in production and handling some rare case for which failure is expensive.

It seems to me that, in the worst case, the downside of your current scheme is an extra field dereference, as in `request.headers.extensions.get("crazyNewField")` instead of `request.headers.get("crazyNewField")`. I think that cost is easily outweighed by the benefits.


I should note that the Rust version currently omits some features of the C++ version, such as read-limiting and the actual counting of the throughput. These things are cheap, but they may explain why Rust is faster in that one case.


We did some benchmarking on IRC today in light of this post and we found that Rust's stdio is currently quite slow due to a flag not being set properly in libuv which causes it to punt to a thread pool. There is currently a fix in the queue: https://github.com/mozilla/rust/pull/10558


In case you get some time would appreciate a blog post or a comment describing what the issue was on the rust side as well as on the libuv side. Upvoted in advance.


Author here. The makefiles I'm using are on github:

https://github.com/dwrensha/capnproto-rust/blob/master/Makef...

https://github.com/dwrensha/capnproto/blob/benchmark/c%2B%2B...

I compiled libcapnp with the latest Clang g++ that ships with XCode. It perhaps would be more fair to also compile the C++ benchmarks with Clang, instead of the Macports gcc4.8 that I'm using, but unfortunately Clang barfs on some template hackery in the benchmark driver.


Update: the compilation error was actually due to some missing includes. https://github.com/kentonv/capnproto/pull/47

Switching compilers on the C++ side doesn't seem to make a significant difference in performance.


That would be quite useful. Otherwise it's very hard to tease apart the differences between optimization back ends of GCC and LLVM vs the Rust and C++ front ends. I feel like I have seen benchmarks showing differences around 5-20% between LLVM and GCC in speed, so the it will have an effect.


You may go a little faster with `--opt-level=3` and no `-Z debug-info` for the Rust.


I often use SML for writing games. The Functioning library (http://github.com/robsimmons/functioning) provides support for SDL and includes an SML port of Box2D.


Don't forget Pittsburgh.


Pittsburgh!


"The Soul of a New Machine" by Tracy Kidder.


I would have to agree; I was surprised how entertaining this book was when read it a few weeks ago after it was mentioned on DadHacker.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: