Why doesn't RoR take advantage of the built-in extension / code methods?

Those outside the ruby ​​community (and some within) the standard ruby ​​links are slow. For many of us, this is irrelevance, operations related to IO, etc. However, when this becomes a problem, we cannot stop us from using our own code to speed things up. To this end, I wonder why RoR (itself is the subject of many "slow" comments) does not use any of its own elements to accelerate?

Is there any special reason? Is there a lack of tight loops for optimization inside the code base?

+3
source share
3 answers

Rails takes advantage of "native", aka compiled, extensions, but saves them as separate and additional libraries. For example, Rails allows you to use nokogiriXML as a parser, rather than a standard Ruby-based parser.

There are at least 3 reasons why Rails will probably not replace internal functions with C / C ++ equivalents.

  • Rails is a Ruby framework. Since this is a Ruby framework, you can expect contributors to learn about Ruby, but using the C libraries you force the entire Ruby ecosystem to also be C programmers. And that would probably mean fewer members of the framework itself.
  • - Windows Gem, C, , , , C Rails.
  • Rails Ruby Ruby, JRuby. C- Ruby, Java/Python/... . , Gems C JRuby.
+10

, ( mysql, memcache, RedCloth ..).

, , . , Ruby .

0

The standard library Date class has been recognized as a bottleneck in some Ruby applications. Jeremy Evans implemented the Date / DateTime classes in C and got a 20-200x performance boost.

home_run

0
source

Source: https://habr.com/ru/post/1733518/


All Articles