3 ms·
As a Python user, I'll give my personal reason for using Python over Ruby. Upfront: I think Ruby is absolutely fantastic. It's a very elegant language. In a lot
by overgard 15y ago
As a Python user, I'll give my personal reason for using Python over Ruby. Upfront: I think Ruby is absolutely fantastic. It's a very elegant language. In a lot of ways I think it's cleaner than python. I'd love to use it.
Except...
Every interpreter I've tried is just too slow. I recently ported over a networking library I wrote in python to ruby, and the requests per second (CPU limited in this case, since it was talking over a loopback socket -- this was just a test of how fast data could be serialized/deserialized) dropped from 7000 requests/sec in python to 120 in ruby. And that was just with standard CPython. Under PyPy, I was able to process about 20,000 requests/sec after letting the JIT warm up.
I realize it's sort of silly to choose a dynamically typed interpreted language on the grounds of performance when you're already giving up so much performance regardless, but in my mind python hits the sweet spot of "just fast enough for most things I need to do", and with all other things being roughly equal (which, in my opinion, they roughly are), being an order of a magnitude factor faster wins out.
- biafra 15y agoDid you give JRuby a try?
- overgard 15y agoI didn't. Perhaps I should, but it seemed like it would have to be at least 10x faster than YARV to be worth it, which looking at the benchmarks seemed unlikely (but who knows? maybe I was hitting some sort of interpreter specific bottleneck)
- attractivechaos 15y agoFor some tasks, JRuby is faster than python and for others, it is slower, but the difference is not big. PyPy is significantly faster in most cases than both.
- jshen 15y agoIs this code public?