<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -8,6 +8,8 @@ module ActionController
           # Development mode callbacks
           before_dispatch :reload_application
           after_dispatch :cleanup_application
+
+          ActionView::Helpers::AssetTagHelper.cache_asset_timestamps = false
         end
 
         if defined?(ActiveRecord)</diff>
      <filename>actionpack/lib/action_controller/dispatcher.rb</filename>
    </modified>
    <modified>
      <diff>@@ -468,6 +468,22 @@ module ActionView
         tag(&quot;img&quot;, options)
       end
 
+      def self.cache_asset_timestamps
+        @@cache_asset_timestamps
+      end
+
+      # You can enable or disable the asset tag timestamps cache.
+      # With the cache enabled, the asset tag helper methods will make fewer
+      # expense file system calls. However this prevents you from modifying
+      # any asset files while the server is running.
+      #
+      #   ActionView::Helpers::AssetTagHelper.cache_asset_timestamps = false
+      def self.cache_asset_timestamps=(value)
+        @@cache_asset_timestamps = value
+      end
+
+      @@cache_asset_timestamps = true
+
       private
         # Add the the extension +ext+ if not present. Return full URLs otherwise untouched.
         # Prefix with &lt;tt&gt;/dir/&lt;/tt&gt; if lacking a leading +/+. Account for relative URL
@@ -526,18 +542,28 @@ module ActionView
           end
         end
 
+        @@asset_timestamps_cache = {}
+        @@asset_timestamps_cache_guard = Mutex.new
+
         # Use the RAILS_ASSET_ID environment variable or the source's
         # modification time as its cache-busting asset id.
         def rails_asset_id(source)
           if asset_id = ENV[&quot;RAILS_ASSET_ID&quot;]
             asset_id
           else
-            path = File.join(ASSETS_DIR, source)
-
-            if File.exist?(path)
-              File.mtime(path).to_i.to_s
+            if @@cache_asset_timestamps &amp;&amp; (asset_id = @@asset_timestamps_cache[source])
+              asset_id
             else
-              ''
+              path = File.join(ASSETS_DIR, source)
+              asset_id = File.exist?(path) ? File.mtime(path).to_i.to_s : ''
+
+              if @@cache_asset_timestamps
+                @@asset_timestamps_cache_guard.synchronize do
+                  @@asset_timestamps_cache[source] = asset_id
+                end
+              end
+
+              asset_id
             end
           end
         end</diff>
      <filename>actionpack/lib/action_view/helpers/asset_tag_helper.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>d2a1c2778e76ba30431121d0a9062272e0c90405</id>
    </parent>
  </parents>
  <author>
    <name>Joshua Peek</name>
    <email>josh@joshpeek.com</email>
  </author>
  <url>http://github.com/rails/rails/commit/ce706b4b9be03a3f2e7d11438e6550d64c5f4461</url>
  <id>ce706b4b9be03a3f2e7d11438e6550d64c5f4461</id>
  <committed-date>2009-01-04T13:39:16-08:00</committed-date>
  <authored-date>2009-01-04T13:39:16-08:00</authored-date>
  <message>Cache AssetTag timestamps</message>
  <tree>13605db641ea72a85be74c1c8f93de4bfc10af83</tree>
  <committer>
    <name>Joshua Peek</name>
    <email>josh@joshpeek.com</email>
  </committer>
</commit>
