Earlier quoted context omitted.
Ruby is slower than php. https://benchmarksgame-team.pages.debian.net/benchmarksgame/...
I've seen conflicting benchmarks on this showing different results - possibly has changed over time, or run different comparisons. What you linked seems current at least.
How to Fix Slow Code in Ruby
91–100 of 213 posts
Re: How to Fix Slow Code in Ruby
#92Earlier quoted context omitted.
Yes TruffleRuby struggles to run test code because it works against the optimisations we add to make production code fast. For example when you add more profiling to better optimise the hot code it makes the cold code slower, and tests are almost all cold code. Also our C extension emulation layer used to be extraordinarily slow while we made it work correctly, and it's still rather slow. It's a challenge but we're w…
What speed gains do you get? Does it ever seen like a lot more trouble to try to optimize ruby instead of just writing slow parts in a different language?
I'm aiming for around 6-10x for real production code.
> Does it ever seen like a lot more trouble to try to optimize ruby instead of just writing slow parts in a different language?
I'm pretty philosophical about this.
People want to write and run Ruby code. I trust they've got their own good reason for that. Taking that as a given, I want to let them run it as fast as they can, with the best tooling I can give them. Instead of 'you shouldn't do that' I want to have the attitude of 'ok we'll see what we can do'.
I do personally really like Ruby and I reach for it pretty much whenever I start a new project.
Re: How to Fix Slow Code in Ruby
#93...Rewrite in almost anything else and you'll have fast code. :) It's quite amazing the lengths the companies will go to just to avoid changing their status quo. But for them it makes sense. --- EDIT: Downvoters, calm down. Ruby on Rails is objectively quite a slow framework and this is proven in many public benchmarks (Techempower included). And Ruby isn't the fastest among the dynamic languages either. Less cargo c…
Re: How to Fix Slow Code in Ruby
#94Re: How to Fix Slow Code in Ruby
#95Earlier quoted context omitted.
> services running those caches and persistence will not be written in ruby So what? What's wrong with using software like redis for cache, for a very small (but important) part of your business? I bet java apps use redis as well, and redis isn't written in java. So?
Is this an honest question? I honestly can't tell and I am not saying it to show disrespect -- just wondering if you are sarcastic. Erlang/Elixir have built-in caches that respond in the matter of 30-150 nanoseconds. Why would you need an external service for that? It's adding complexity -- and likely hosting costs. Isn't it self-evident to you that adding Redis as a caching layer to your stack is a bandaid to a deep…
We're also dependent on mysql, are you gonna implement that in Elixir as well? Redis is a great piece of software, and it's a real SHARED cache, so it could work for sessions or other small state management you sometimes want to remember for example. What you described won't work for that.
Re: How to Fix Slow Code in Ruby
#96What's current state on GraalVM as it relates to running production Ruby code? From what I understand, it's the fastest VM out there at the moment for Ruby. And yes, it's from Oracle but they have GPL'd the code [2] [1] https://www.graalvm.org [2] https://www.graalvm.org/docs/faq/ Edit: looks like TruffleRuby is built onto of Graal. https://github.com/oracle/truffleruby
Last time I tried to run Truffle on the company test suite it spent an hour processing 1/8th of the suite. Then it was killed by the OOM killer. On a 32 GB machine. To be fair there was only one or two errors during that, so compatibility is at least getting there. Meanwhile Ruby 2.6.5 chugs along and finishes the whole suite in 8 minutes. Never hitting any unreasonable amounts of memory.
Re: How to Fix Slow Code in Ruby
#97Ruby used to be able to say we sacrifice performance for developer productivity.
I don’t think this is any longer true, there’s plenty of languages out there that developers can be just as productive with, while producing wildly more performant code.
Re: How to Fix Slow Code in Ruby
#98Earlier quoted context omitted.
What speed gains do you get? Does it ever seen like a lot more trouble to try to optimize ruby instead of just writing slow parts in a different language?
> What speed gains do you get? I'm aiming for around 6-10x for real production code. > Does it ever seen like a lot more trouble to try to optimize ruby instead of just writing slow parts in a different language? I'm pretty philosophical about this. People want to write and run Ruby code. I trust they've got their own good reason for that. Taking that as a given, I want to let them run it as fast as they can, with th…
Re: How to Fix Slow Code in Ruby
#99Earlier quoted context omitted.
Basically do not use Ruby
How is it that Python is able to do so many things quickly (even excluding NumPy/SciPy)? Is it more native code libraries? Could Ruby follow this path as effectively?
http://esr.ibiblio.org/?p=8161
Basically, what he found is that for programs that work with large graphs of objects (as opposed to arrays of numbers, which are the domain of numpy and friends), Python isn't all that fast. I don't know how it compares to Ruby though.
Re: How to Fix Slow Code in Ruby
#100Earlier quoted context omitted.
And yet Phoenix hasn't stolen a significant amount of market share from Rails. > There are a number of web frameworks that perform much better than Rails If you're measuring hardware loads and busting out your stopwatch to measure response times, then sure. Bottom line is, there are plenty of good reasons to choose Rails over Phoenix. If you want to label choosing a well-backed framework with an incredibly mature eco…
> And yet Phoenix hasn't stolen a significant amount of market share from Rails. I thought we all learned popularity does not correlate with quality. It correlates pretty closely with corporate inertia and perceived lower risk of developer churn though. Businesses love tech stack for which there are bigger pools of programmers. Says nothing of the quality of the stacks. > If you're measuring hardware loads and bustin…