Permalink
Browse files

duration is called multiple times in dev, so lets cache it

  • Loading branch information...
1 parent d1b618b commit 48c8135423dd7a8ff676b858cad6795a15903826 @tenderlove tenderlove committed Aug 18, 2013
Showing with 2 additions and 1 deletion.
  1. +2 −1 activesupport/lib/active_support/notifications/instrumenter.rb
@@ -54,10 +54,11 @@ def initialize(name, start, ending, transaction_id, payload)
@transaction_id = transaction_id
@end = ending
@children = []
+ @duration = nil
end
def duration
- 1000.0 * (self.end - time)
+ @duration ||= 1000.0 * (self.end - time)
end
def <<(event)

0 comments on commit 48c8135

Please sign in to comment.