Answer the question
In order to leave comments, you need to log in
How slow is Ruby on Rails?
I began to master the Ruby programming language and, in the context of it, I am simultaneously getting acquainted with the Rails framework. Reading articles on topics related to it, I often encountered, in a way, reproaches against the "slowness" of the language and the above framework. How critical is this? What does this mean at the kernel level?
Answer the question
In order to leave comments, you need to log in
Your question is caused by premature optimization , which is bad in 97% of cases.
Conclusion - do not ask such questions until it becomes a very highly specialized task.
TL; DR:
Neither Ruby nor Rails are slow in real world web development
Ruby and Rails can be considered relatively slow for the following reasons:
1. Ruby is an interpreted language
2. Ruby is a lot of sugar for productive development and support. Sometimes this really affects performance.
3. There are a lot of things in the rails out of the box. But they are not always needed. Also, many best practices and just answers in different sources show the most readable \ simple \ supported option, and not the most productive one.
Usually, it is not this or that language that slows down, but the code that you wrote in it. Today, tasks where certain features of the language / framework are needed to achieve this or that performance are a very rare and specific question: scientific calculations, visualization, network interactions ...
But in fact, it doesn’t matter, anyway, a serious application will be hosted on multiple machines. The rail limit is said to be 16000 RPS (requests per second) per server.
Read Why do people say that Ruby is slow? and draw your own conclusion.
Since you are in the world of web frameworks, you should not think about the slowness of the language, anyway, 95% of the request time will be taken by the response from the database.
It all depends on the task, for example, I made an API prototype. Without calls to the database, the request was processed in 1-2ms, we add a request to the database, we get already 14. Complex sorting is needed, we make the first approximation to the database with post-processing, already 40. Pagination = each request for 40-50. We make the maximum selection complex sorting on the application side and taking the range, 90 (most of it is spent on data transfer), but the result is exactly in the order that is needed. What if you cache. We put it in the cache. In total, the first request of the first page is 90-95 the second is 3-5, in total, the further we scroll, the cheaper each page becomes on average, 50-30-25-20 and so on. But all this took a couple of hours from idea to working prototype. How long would it take in more productive languages.
Before you hit the language, you will need to get so many users to begin with, and this is a separate task. And you can always rewrite bottlenecks.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question