Re:Making Code Faster
by Gigachad on Monday June 13, 2022 @08:48PM
(#31733521)
Anyone with APM setup can see what’s going on pretty well. For almost all web apps, you can see that ruby/python are extremely fast and almost all of the time spent on a request is the database.
[ Parent
| on HN ]
The implication is likely that the db does all the work, and the parts in ruby/python have barely anything to do.
This is true of every rails app I have worked on in the last 10 years. You’d have to be doing something remarkably bad or have some crazy situation to end up with ruby using any noticeable amount of compute time.
Well that depends on what your application is doing. But yes, if it is a database heavy workload, then what you say applies.
What I was trying to get at was that in these cases the ruby/python/whatever parts are not actually fast, they just do much less stuff. Add that the database might be on another machine, so there's plenty of overhead as well.
Aside: You can sometimes get orders of magnitude of speed gains just by using an embedded database and a fast language on top if your workload allows it. Essentially you don't really do much to get this, just cut overhead.