diff --git a/lib/ruby-prof/method_info.rb b/lib/ruby-prof/method_info.rb index 5c478a49..c4acdb6f 100644 --- a/lib/ruby-prof/method_info.rb +++ b/lib/ruby-prof/method_info.rb @@ -61,13 +61,15 @@ def ==(other) end def <=>(other) + sort_delta = 0.0001 + if other.nil? -1 elsif self.full_name == other.full_name 0 - elsif self.total_time < other.total_time && (self.total_time - other.total_time).abs > 0.0001 + elsif self.total_time < other.total_time && (self.total_time - other.total_time).abs > sort_delta -1 - elsif self.total_time > other.total_time && (self.total_time - other.total_time).abs > 0.0001 + elsif self.total_time > other.total_time && (self.total_time - other.total_time).abs > sort_delta 1 elsif self.call_trees.min_depth < other.call_trees.min_depth 1