The speed of Ruby and Java [closed]
In every benchmark that I found on the web it seems that Ruby is slow, much slower than Java. The Ruby folks just state that it doesn't matter. Could you g开发者_StackOverflow社区ive me any example that the speed of Ruby on Rails (and the Ruby itself) really doesn't matter?
You should really only concern yourself with whether or not Ruby on Rails will be fast enough for your use case. To that end, it's certainly fast enough for all of these folks.
If you have a CMS that renders out a flat site each night at midnight... then your application is running for 1 second per evening in Java, or 2 seconds per night in Ruby. It simply would not matter.
For many web applications, it is often the case that the bottleneck in the request/response cycle is not the processing speed of the web framework, but rather database access times. Given that, many people find the overhead added by using a relatively slow language a reasonable tradeoff for speed and ease of development.
A typical web application spends very little time doing the things you would write in Ruby or Java and very much time fetching things from a database. If it takes 200ms to deliver a given page using Java and 210ms using RoR, the advantage gained by choosing Java for its speed is insignificant for the vast majority of applications.
If you're really worried about speed in a typical web application, spend your optimization efforts on the data storage and retrieval mechanism, not the front end. Use indexes. Denormalize data if you must. Consider a document database or a key-value store.
精彩评论