mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Avoid Time.parse
for static date
Benchmark.ips do |x| x.report('Time.parse') { Time.parse('2011-01-01') } x.report('Time.new') { Time.new(2011, 1, 1) } end Calculating ------------------------------------- Time.parse 6.640k i/100ms Time.new 15.082k i/100ms ------------------------------------------------- Time.parse 71.915k (± 3.1%) i/s - 365.200k Time.new 167.645k (± 3.3%) i/s - 844.592k
This commit is contained in:
parent
f390bd42b8
commit
040ed26656
1 changed files with 1 additions and 1 deletions
|
@ -228,7 +228,7 @@ module ActionController
|
|||
expires_in 100.years, public: public
|
||||
|
||||
yield if stale?(etag: "#{version}-#{request.fullpath}",
|
||||
last_modified: Time.parse('2011-01-01').utc,
|
||||
last_modified: Time.new(2011, 1, 1).utc,
|
||||
public: public)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue