惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

B
Blog
量子位
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Last Week in AI
Last Week in AI
酷 壳 – CoolShell
酷 壳 – CoolShell
人人都是产品经理
人人都是产品经理
Jina AI
Jina AI
雷峰网
雷峰网
博客园_首页
WordPress大学
WordPress大学
博客园 - 司徒正美
爱范儿
爱范儿
博客园 - 聂微东
IT之家
IT之家
美团技术团队
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 三生石上(FineUI控件)
有赞技术团队
有赞技术团队
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
T
Tailwind CSS Blog
博客园 - Franky
V
V2EX
GbyAI
GbyAI
阮一峰的网络日志
阮一峰的网络日志

Ruby on Rails: Compress the complexity of modern web apps

Safer to_i coercion, custom to_fs formats, and more! This Week in Rails: May 16, 2026 This Week in Rails: May 8, 2026 This Week in Rails: May 1, 2026 Active Record gets better every week Great big Rails World 2026 update: CFP, Corporate Support tickets, workshops Query command for database queries and more Explicit query: and body: kwargs for integration tests and more! Speedup ActiveRecord::LogSubscriber#sql_color and more! This Week in Rails: March 27, 2026 Rails Versions 8.0.5 and 8.1.3 have been released! Rails Versions 7.2.3.1, 8.0.4.1, and 8.1.2.1 have been released! This Week in Rails: March 20, 2026 Validate URI scheme in Action Text and more This Week in Rails: March 6, 2026 Planning Center is the newest Rails Foundation Contributing member Action Text gets Markdown conversion, editor links in devcontainers, and more! BARRA seeks Rails developer Joe Agliozzo is looking for a Rails developer The rise of lighttpd as the alternative web server When longer is better and more is more Snowdevil: First e-tailer on Rails Natural selection for frameworks in Ruby vs Java Address book tutorial in Portuguese Becoming a better programmer with Rails 10 Things Every Java Programmer Should Know About Ruby Really Getting Started in Rails Off the Treadmill, Onto the Rails Rails 0.9.5: A world of fixes and tweaks Rich clients with Rails and XUL
Snappier Development Mode in Rails 5
David Heinemeier Hansson · 2015-11-11 · via Ruby on Rails: Compress the complexity of modern web apps

Wednesday, November 11, 2015
Posted by fxn

In Rails 5 development mode is going to be a tad snappier for large code bases.

As you know, when a request comes in Rails reloads1 applications in development mode2 if something has changed. The way this is done has evolved over the years.

For a long time Rails simply reloaded unconditionally in every request.

Rails 3.2 improved that with the implementation of a file system monitor which (mod details) walks the application tree on every request checking mtimes.

That tree walk is done per request, not per page view. In particular, it happens when serving each one of the assets so, albeit walking an application tree once may not be a big deal, it may add up depending on the number of assets and how large is your code base.

Rails 5 is going to ship also with an evented file system monitor. When something changes the operating system calls Rails asynchronously and a flag is toggled. When a request comes in, the flag is checked, done.

This monitor is disabled by default, applications may opt-in just loading the listen gem in their Gemfile:

group :development do
  gem 'listen', '~> 3.0.4'
end

On Linux and Mac OS X there are no additional dependencies, but some are required for *BSD and for Windows. Note that some setups are unsupported.

Even if the evented monitor is enabled, the console still needs manual reload because it could be surprising that classes change behind the scenes while there are objects already instantiated. Better be explicit.

Thanks to Puneet Agarwal, who wrote the initial patch for this feature as part of this year’s GSoC.

Also kudos to the listen authors and maintainers, thanks to listen this was infinitely easier to implement in a portable way.


1 For a technical explanation of what “reloading” means please check the Autoloading and Reloading Constants guide.

2 Technically when config.cache_classes is false.