Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails Rails:当cache_类为false时,部分渲染速度变慢_Ruby On Rails_Ruby On Rails 4_Ruby On Rails 3.2 - Fatal编程技术网

Ruby on rails Rails:当cache_类为false时,部分渲染速度变慢

Ruby on rails Rails:当cache_类为false时,部分渲染速度变慢,ruby-on-rails,ruby-on-rails-4,ruby-on-rails-3.2,Ruby On Rails,Ruby On Rails 4,Ruby On Rails 3.2,我正在将Rails 3.2应用程序升级到版本5。我要做的第一件事是升级到版本4,并使所有测试仍然通过 我注意到的一件事是,我的应用程序现在在开发模式中非常缓慢。在3.2中,有些请求的时间不到50毫秒,但却需要1500毫秒 经过一些调试,我发现如果在版本4中启用cache_类配置,我将获得与在版本3.2中禁用cache_类时类似的性能 Rails 4.2.9(config.cache\u classes=false) (previous render messages intentionally

我正在将Rails 3.2应用程序升级到版本5。我要做的第一件事是升级到版本4,并使所有测试仍然通过

我注意到的一件事是,我的应用程序现在在开发模式中非常缓慢。在3.2中,有些请求的时间不到50毫秒,但却需要1500毫秒

经过一些调试,我发现如果在版本4中启用cache_类配置,我将获得与在版本3.2中禁用cache_类时类似的性能

Rails 4.2.9(config.cache\u classes=false)

(previous render messages intentionally removed )
  Rendered application/_row.html.erb (91.2ms)
  Rendered application/_row.html.erb (104.1ms)
  Rendered application/_row.html.erb (103.9ms)
Completed 200 OK in 1617ms (Views: 1599.0ms | ActiveRecord: 8.3ms)
(previous render messages intentionally removed )
  Rendered application/_row.html.erb (2.3ms)
  Rendered application/_row.html.erb (2.5ms)
  Rendered application/_row.html.erb (2.0ms)
Completed 200 OK in 59ms (Views: 41.8ms | ActiveRecord: 7.7ms
Rails 4.2.9(config.cache\u classes=true)

(previous render messages intentionally removed )
  Rendered application/_row.html.erb (91.2ms)
  Rendered application/_row.html.erb (104.1ms)
  Rendered application/_row.html.erb (103.9ms)
Completed 200 OK in 1617ms (Views: 1599.0ms | ActiveRecord: 8.3ms)
(previous render messages intentionally removed )
  Rendered application/_row.html.erb (2.3ms)
  Rendered application/_row.html.erb (2.5ms)
  Rendered application/_row.html.erb (2.0ms)
Completed 200 OK in 59ms (Views: 41.8ms | ActiveRecord: 7.7ms
根据我所能检查的,当config.cache_classes=false时,Rails不再缓存部分和类。即使是在3.2版本中的请求也不一样

我还检查了config.reload_classes_only_on_change,这似乎是相关的,设置为true

我是否应该检查/更改其他内容,以获得类似于我在3.2中禁用缓存类时使用的内容?还是Rails中无法修复的回归

不幸的是,启用cache_类进行开发是不可行的

注1:我创建了一个空的rails 4.2.9,通过创建大量的部分并启用/禁用cache_类,可以重现这个问题

注2:同样的问题似乎也发生在Rails 5中。我将重点放在Rails 4上,因为这是我现在正在工作的一个