Hacker News new | ask | show | jobs
by Dowwie 3137 days ago
I never got around to talking about it, but as part of my "month of Rust", I ported permission-based authorization logic from Python to Rust and then ran performance benchmarks of the Rust implementation and a pypy-compiled version. The pypy-compiled python ran slightly faster.

I've been told not to expect similar results in other implementations. These findings cannot be used to draw any conclusions about pypy.

My rust project: https://github.com/YosaiProject/yosai_libauthz

3 comments

That's pretty interesting - JIT's can do a lot of great optimizations with runtime information, but I'm still surprised to hear that Pypy was faster. It would be cool to see the benchmarks, methodology, and Python code.

Personally, Pypy has never been an option due to the nature of the codebases I work on - or at least it wasn't. I was using pandas, numpy, scipy etc and I don't think it was compatible.

Very interesting. I glanced at the code to see if there were obvious performance issues. All I noticed was a triple `map` invocation in https://github.com/YosaiProject/yosai_libauthz/blob/master/s...

Not sure what the compiler does with that, but I'd expect that it means you're running through those elements three times. I imagine it would be better to reduce this to one `map` call.

ah you're looking at the CABI stuff.. that part wasn't benchmarked because I wanted as close to apples to apples as I could get and know that the cffi bridge taxes performance

here's the actual rust library: https://github.com/Dowwie/rust-authz/blob/master/src/authz.r...

the project includes a bench

I don't understand all the implications, but I often hear from JIT language people that their language could be as fast as a AOT language if it was used correctly.

What are the use-cases that lend itself to be faster in Rust, than JS/Ruby/Phython?

Fwiw, Ruby does get much more performant with JRuby but nobody cares that much because the benefits are mostly lost with Rails.
I would like to know this as well. This code is one instance of it.