Project

General

Profile

Bug #11581

Updated by robsdrops (Robert Pawlas) over 9 years ago

I was playing today with Ruby profiler and found something strange in my results. Let's take a sample code from docs: 

 ~~~ 
 require 'profile' 

 def slow_method 
   5000.times do 
     9999999999999999*999999999 
   end 
 end 

 def fast_method 
   5000.times do 
     9999999999999999+999999999 
   end 
 end 

 slow_method 
 fast_method 
 ~~~ 

 Results of methods calls should look like: 

 ~~~ 
 0.00       0.19        0.00          1       0.00     100.00    Object#slow_method 
 0.00       0.19        0.00          1       0.00      90.00    Object#fast_method 
 ~~~ 

 But my results are: 

 ~~~ 
 35.00       0.15        0.07       5001       0.01       0.03    Object#fast_method 
 10.00       0.19        0.02       5001       0.00       0.03    Object#slow_method 
 ~~~ 

 And it doesn't seem to be proper. Those methods are called once, not 5001 times. 
 Btw. I'm using **ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-linux]** 
 On 1.9.3 everything works fine. And it doesn't look it is a intentional change. But if yes, please enlighten me.  

 Thanks 

 robsdrops

Back