[ruby-core:93460] [Ruby master Bug#11581] profiler extra method calls

From: merch-redmine@...
Date: 2019-07-01 20:48:43 UTC
List: ruby-core #93460
Issue #11581 has been updated by jeremyevans0 (Jeremy Evans).

Status changed from Open to Closed

`profile` was removed from the standard library a few months ago.

----------------------------------------
Bug #11581: profiler extra method calls
https://bugs.ruby-lang.org/issues/11581#change-79009

* Author: robsdrops (Robert Pawlas)
* Status: Closed
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 2.2.1p85 (2015-02-26 revision 49769) [x86_64-linux]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
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.
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



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next