# Ruby profile gave different result in Windows and Linux

**URL:** <https://www.ruby-forum.com/t/ruby-profile-gave-different-result-in-windows-and-linux/77681>\
**Category:** Ruby\
**Created:** [November 29, 2006, 6:32pm UTC](https://www.ruby-forum.com/t/ruby-profile-gave-different-result-in-windows-and-linux/77681 "2006-11-29T18:32:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Luan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/b9bd4f/32.png) [@Luan](https://www.ruby-forum.com/u/Luan)\
**Post date:** [November 29, 2006, 6:32pm UTC](https://www.ruby-forum.com/t/ruby-profile-gave-different-result-in-windows-and-linux/77681/1 "2006-11-29T18:32:10Z")

</div>

Hi All,

I am using “ruby -r profile prog” for the same program between Windows  
and  
Linux.

I got the different result. In Windows, I got

```
                                  calls

```

9.52 0.35 0.06 865 0.07 0.07  
Module#method\_added

but in Linux, I only got  
calls  
0.00 0.23 0.00 17 0.00 0.00  
Module#method\_added

Do you know why there’s a big different between the two?

Thanks for your help.  
Luan

Here is the full result

Linux

% cumulative self self total  
time seconds seconds calls ms/call ms/call name  
42.86 0.10 0.10 62 1.61 6.72 Hash#each  
14.29 0.13 0.03 7 4.76 14.29 Array#each  
7.14 0.15 0.02 138 0.12 0.12 Fixnum#+  
7.14 0.17 0.02 282 0.06 0.06 Hash#[]  
7.14 0.18 0.02 80 0.21 0.21 Float#/  
7.14 0.20 0.02 1 16.67 133.33 Kernel.loop  
7.14 0.22 0.02 22 0.76 0.76 Ir#calc\_doc\_freq  
7.14 0.23 0.02 462 0.04 0.04 Float#\*\*  
0.00 0.23 0.00 22 0.00 0.00  
Ir#calc\_term\_weight  
0.00 0.23 0.00 1 0.00 83.33  
Ir#process\_relevance\_query  
0.00 0.23 0.00 5 0.00 0.00 Fixnum#-  
0.00 0.23 0.00 3 0.00 16.67 IO#open  
0.00 0.23 0.00 152 0.00 0.00 Hash#[]=  
0.00 0.23 0.00 2 0.00 0.00 Array#include?  
0.00 0.23 0.00 1 0.00 0.00 Ir#relevance\_query  
0.00 0.23 0.00 1 0.00 33.33 Ir#process\_query  
0.00 0.23 0.00 4 0.00 0.00 Hash#has\_key?  
0.00 0.23 0.00 2 0.00 0.00 Float#-  
0.00 0.23 0.00 1 0.00 0.00  
Ir#calc\_relevance\_query  
0.00 0.23 0.00 7 0.00 0.00 Hash#clear  
0.00 0.23 0.00 67 0.00 0.00 Fixnum#\>  
0.00 0.23 0.00 1 0.00 0.00 Dir#[]  
0.00 0.23 0.00 6 0.00 0.00 Float#to\_s  
0.00 0.23 0.00 2 0.00 0.00 Kernel.==  
0.00 0.23 0.00 13 0.00 0.00 IO#write  
0.00 0.23 0.00 1 0.00 100.00  
Ir#create\_docs\_terms\_hash  
0.00 0.23 0.00 52 0.00 0.00 Math.log10  
0.00 0.23 0.00 1 0.00 0.00 Class#inherited  
0.00 0.23 0.00 2 0.00 0.00  
Ir#check\_document\_exists  
0.00 0.23 0.00 2 0.00 0.00 Ir#print  
0.00 0.23 0.00 20 0.00 0.00 Array#[]  
0.00 0.23 0.00 452 0.00 0.00 Float#+  
0.00 0.23 0.00 72 0.00 0.00 Float#\*  
0.00 0.23 0.00 48 0.00 0.00 Fixnum#to\_f  
0.00 0.23 0.00 2 0.00 58.33  
Ir#build\_query\_similarity  
0.00 0.23 0.00 1 0.00 0.00  
Ir#calc\_query\_weight  
0.00 0.23 0.00 22 0.00 0.76 Ir#calc\_term\_freq  
0.00 0.23 0.00 105 0.00 0.00 Hash#default  
0.00 0.23 0.00 6 0.00 0.00 IO#gets  
0.00 0.23 0.00 2 0.00 0.00 Hash#empty?  
0.00 0.23 0.00 12 0.00 0.00 Math.sqrt  
0.00 0.23 0.00 4 0.00 0.00 String#split  
0.00 0.23 0.00 17 0.00 5.88 Class#new  
0.00 0.23 0.00 2 0.00 0.00 String#==  
0.00 0.23 0.00 2 0.00 0.00 Hash#sort  
0.00 0.23 0.00 119 0.00 0.00 String#downcase  
0.00 0.23 0.00 1 0.00 100.00 Ir#initialize  
0.00 0.23 0.00 3 0.00 0.00 File#initialize  
0.00 0.23 0.00 1 0.00 0.00 Kernel.lambda  
0.00 0.23 0.00 17 0.00 0.00  
Module#method\_added  
0.00 0.23 0.00 6 0.00 0.00 Float#\>  
0.00 0.23 0.00 13 0.00 0.00 Kernel.printf  
0.00 0.23 0.00 6 0.00 0.00 Proc#call  
0.00 0.23 0.00 16 0.00 0.00 Hash#initialize  
0.00 0.23 0.00 1 0.00 0.00  
Ir#non\_relevance\_query  
0.00 0.23 0.00 2 0.00 0.00 String#chomp  
0.00 0.23 0.00 4 0.00 0.00 Float#\<=\>  
0.00 0.23 0.00 4 0.00 0.00 Kernel.gets  
0.00 0.23 0.00 1 0.00 50.00  
Ir#calc\_term\_weight\_for\_hash  
0.00 0.23 0.00 22 0.00 0.00 Float#to\_f  
0.00 0.23 0.00 1 0.00 233.33 #toplevel

```
    Windows

      % cumulative self self total

```

time seconds seconds calls ms/call ms/call name  
22.31 0.14 0.14 30 4.77 37.43 Kernel.require  
22.00 0.28 0.14 63 2.24 8.94 Hash#each  
9.52 0.35 0.06 865 0.07 0.07  
Module#method\_added  
7.33 0.39 0.05 174 0.27 0.36 String#gsub!  
4.84 0.42 0.03 462 0.07 0.07 Float#\*\*  
4.84 0.45 0.03 174 0.18 0.54 Config.expand  
4.84 0.49 0.03 16 1.94 4.94 Array#each  
4.84 0.52 0.03 452 0.07 0.07 Float#+  
2.50 0.53 0.02 52 0.31 0.31 Math.log10  
2.50 0.55 0.02 122 0.13 0.13 Kernel.dup  
2.50 0.56 0.02 1 16.00 94.00 Hash#each\_value  
2.50 0.58 0.02 15 1.07 1.07 Module#private  
2.34 0.60 0.02 20 0.75 0.75 Module#module\_eval  
2.34 0.61 0.02 105 0.14 0.14 Symbol#===  
2.34 0.63 0.01 527 0.03 0.03 Hash#[]=  
0.00 0.63 0.00 19 0.00 0.00  
Gem::Specification#attribute  
0.00 0.63 0.00 48 0.00 0.00 Fixnum#to\_f  
0.00 0.63 0.00 2 0.00 78.00  
Ir#build\_query\_similarity  
0.00 0.63 0.00 3 0.00 0.00 Array#join  
0.00 0.63 0.00 1 0.00 0.00 Gem.user\_home  
0.00 0.63 0.00 1 0.00 0.00  
Ir#calc\_relevance\_query  
0.00 0.63 0.00 1 0.00 0.00 Module#extended  
0.00 0.63 0.00 70 0.00 0.00 Symbol#to\_s  
0.00 0.63 0.00 28 0.00 0.00  
Module#attr\_accessor  
0.00 0.63 0.00 1 0.00 0.00 Ir#relevance\_query  
0.00 0.63 0.00 3 0.00 0.00 Hash#keys  
0.00 0.63 0.00 7 0.00 0.00  
Gem::Specification#required\_attribute  
0.00 0.63 0.00 44 0.00 0.00 Array#\<\<  
0.00 0.63 0.00 1 0.00 46.00 Ir#process\_query  
0.00 0.63 0.00 13 0.00 0.00 Kernel.printf  
0.00 0.63 0.00 22 0.00 0.73 Ir#calc\_doc\_freq  
0.00 0.63 0.00 1 0.00 0.00 String#chomp!  
0.00 0.63 0.00 3 0.00 0.00 Module#public  
0.00 0.63 0.00 1 0.00 156.00 Kernel.loop  
0.00 0.63 0.00 2 0.00 0.00 Hash#empty?  
0.00 0.63 0.00 1 0.00 47.00  
Ir#calc\_term\_weight\_for\_hash  
0.00 0.63 0.00 2 0.00 0.00 String#chomp  
0.00 0.63 0.00 1 0.00 0.00  
Gem::Version::Requirement#default  
0.00 0.63 0.00 10 0.00 0.00  
Gem::Specification#overwrite\_accessor  
0.00 0.63 0.00 1 0.00 0.00  
Forwardable.def\_delegators  
0.00 0.63 0.00 1 0.00 0.00  
Module#alias\_method  
0.00 0.63 0.00 5 0.00 0.00 Hash#merge  
0.00 0.63 0.00 72 0.00 0.00 Float#\*  
0.00 0.63 0.00 6 0.00 0.00 Proc#call  
0.00 0.63 0.00 1 0.00 110.00  
Ir#process\_relevance\_query  
0.00 0.63 0.00 2 0.00 0.00 Ir#print  
0.00 0.63 0.00 16 0.00 0.00 Hash#initialize  
0.00 0.63 0.00 6 0.00 0.00 Float#\>  
0.00 0.63 0.00 2 0.00 0.00 Regexp#match  
0.00 0.63 0.00 1 0.00 94.00 Ir#initialize  
0.00 0.63 0.00 2 0.00 0.00 MatchData#[]  
0.00 0.63 0.00 3 0.00 5.33 IO#open  
0.00 0.63 0.00 75 0.00 0.00 String#[]  
0.00 0.63 0.00 9 0.00 1.67  
Gem::Specification#array\_attribute  
0.00 0.63 0.00 6 0.00 0.00 Float#to\_s  
0.00 0.63 0.00 2 0.00 0.00 Kernel.==  
0.00 0.63 0.00 2 0.00 0.00  
Module#private\_class\_method  
0.00 0.63 0.00 11 0.00 0.00 Module#included  
0.00 0.63 0.00 7 0.00 0.00 Hash#clear  
0.00 0.63 0.00 11 0.00 0.00 Module#include  
0.00 0.63 0.00 5 0.00 3.00 Hash#each\_pair  
0.00 0.63 0.00 4 0.00 0.00 Hash#has\_key?  
0.00 0.63 0.00 2 0.00 0.00 Array#collect  
0.00 0.63 0.00 1 0.00 0.00  
Gem::Version::Requirement#parse  
0.00 0.63 0.00 7 0.00 0.00 Array#first  
0.00 0.63 0.00 7 0.00 0.00 Regexp#quote  
0.00 0.63 0.00 11 0.00 0.00  
Module#append\_features  
0.00 0.63 0.00 2 0.00 0.00 Float#-  
0.00 0.63 0.00 2 0.00 0.00 Array#include?  
0.00 0.63 0.00 2 0.00 0.00  
Module#module\_function  
0.00 0.63 0.00 2 0.00 0.00  
Ir#check\_document\_exists  
0.00 0.63 0.00 22 0.00 0.00 Ir#calc\_term\_freq  
0.00 0.63 0.00 1 0.00 0.00 File#join  
0.00 0.63 0.00 1 0.00 0.00 Kernel.extend  
0.00 0.63 0.00 4 0.00 0.00 String#split  
0.00 0.63 0.00 22 0.00 0.00 Array#[]  
0.00 0.63 0.00 10 0.00 0.00  
Module#remove\_method  
0.00 0.63 0.00 12 0.00 0.00 Math.sqrt  
0.00 0.63 0.00 4 0.00 0.00 Kernel.gets  
0.00 0.63 0.00 8 0.00 0.00 Kernel.lambda  
0.00 0.63 0.00 1 0.00 0.00  
Ir#non\_relevance\_query  
0.00 0.63 0.00 126 0.00 0.00 Hash#default  
0.00 0.63 0.00 138 0.00 0.00 Fixnum#+  
0.00 0.63 0.00 3 0.00 0.00  
Module#method\_undefined  
0.00 0.63 0.00 165 0.00 0.00  
Kernel.singleton\_method\_added  
0.00 0.63 0.00 6 0.00 0.00 Kernel.kind\_of?  
0.00 0.63 0.00 5 0.00 0.00  
Hash#initialize\_copy  
0.00 0.63 0.00 2 0.00 0.00 Hash#sort  
0.00 0.63 0.00 5 0.00 0.00 Float#\<=\>  
0.00 0.63 0.00 1 0.00 94.00  
Ir#create\_docs\_terms\_hash  
0.00 0.63 0.00 4 0.00 0.00 String#==  
0.00 0.63 0.00 2 0.00 8.00  
Gem::Specification#read\_only  
0.00 0.63 0.00 2 0.00 0.00  
Forwardable.def\_instance\_delegator  
0.00 0.63 0.00 8 0.00 0.00 Kernel.eval  
0.00 0.63 0.00 2 0.00 7.50 Module#attr  
0.00 0.63 0.00 14 0.00 0.00 Regexp#to\_s  
0.00 0.63 0.00 1 0.00 0.00 Gem.ssl\_available?  
0.00 0.63 0.00 9 0.00 0.00 Module#class\_eval  
0.00 0.63 0.00 80 0.00 0.00 Float#/  
0.00 0.63 0.00 5 0.00 3.00  
Gem::Security::Policy#initialize  
0.00 0.63 0.00 1 0.00 0.00  
Ir#calc\_query\_weight  
0.00 0.63 0.00 78 0.00 0.00 Fixnum#\*  
0.00 0.63 0.00 119 0.00 0.00 String#downcase  
0.00 0.63 0.00 68 0.00 0.00 Fixnum#\>  
0.00 0.63 0.00 1 0.00 0.00 Dir#[]  
0.00 0.63 0.00 2 0.00 0.00 Module#attr\_writer  
0.00 0.63 0.00 10 0.00 0.00  
Module#method\_removed  
0.00 0.63 0.00 13 0.00 0.00 IO#write  
0.00 0.63 0.00 1 0.00 0.00 Gem.find\_home  
0.00 0.63 0.00 4 0.00 0.00 Fixnum#-  
0.00 0.63 0.00 1 0.00 0.00  
Gem::Version::Requirement#initialize  
0.00 0.63 0.00 3 0.00 0.00 File#initialize  
0.00 0.63 0.00 22 0.00 0.00 Float#to\_f  
0.00 0.63 0.00 3 0.00 0.00 ENV.[]  
0.00 0.63 0.00 2 0.00 0.00  
Gem::Specification#attributes  
0.00 0.63 0.00 122 0.00 0.00  
String#initialize\_copy  
0.00 0.63 0.00 355 0.00 0.00 Hash#[]  
0.00 0.63 0.00 1 0.00 0.00  
Gem::Version#initialize  
0.00 0.63 0.00 1 0.00 0.00  
Gem::Version#correct?  
0.00 0.63 0.00 26 0.00 4.19 Class#new  
0.00 0.63 0.00 2 0.00 0.00 File#dirname  
0.00 0.63 0.00 119 0.00 0.00 Class#inherited  
0.00 0.63 0.00 1 0.00 0.00  
Module#extend\_object  
0.00 0.63 0.00 18 0.00 0.00  
Module#define\_method  
0.00 0.63 0.00 6 0.00 0.00 IO#gets  
0.00 0.63 0.00 22 0.00 0.00  
Ir#calc\_term\_weight  
0.00 0.63 0.00 4 0.00 0.00  
Gem::Specification#attribute\_alias\_singular  
0.00 0.63 0.00 2 0.00 0.00 Regexp#initialize  
0.00 0.64 0.00 1 0.00 641.00 #toplevel

---

<div class="post-metadata">

**Author:** ![Luan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/b9bd4f/32.png) [@Luan](https://www.ruby-forum.com/u/Luan)\
**Post date:** [November 29, 2006, 7:10pm UTC](https://www.ruby-forum.com/t/ruby-profile-gave-different-result-in-windows-and-linux/77681/2 "2006-11-29T19:10:25Z")

</div>

On 11/29/06, Luan [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Here is the full result  
> 7.14 0.18 0.02 80 0.21 0.21 Float#/  
> 0.00 0.23 0.00 1 0.00 0.00 Ir#relevance\_query  
> 0.00 0.23 0.00 13 0.00 0.00 IO#write  
> 0.00 0.23 0.00 48 0.00 0.00 Fixnum#to\_f  
> 0.00 0.23 0.00 2 0.00 0.00 String#==  
> 0.00 0.23 0.00 1 0.00 0.00 Ir#non\_relevance\_query
> 
> 4.84 0.45 0.03 174 0.18 0.54 Config.expand  
> Gem::Specification#attribute  
> 0.00 0.63 0.00 1 0.00 0.00 Ir#relevance\_query  
> 0.00 0.63 0.00 2 0.00 0.00 Hash#empty?  
> 0.00 0.63 0.00 5 0.00 0.00 Hash#merge  
> 0.00 0.63 0.00 3 0.00 5.33 IO#open  
> 0.00 0.63 0.00 5 0.00 3.00 Hash#each\_pair  
> 0.00 0.63 0.00 2 0.00 0.00  
> 0.00 0.63 0.00 1 0.00 0.00 Ir#non\_relevance\_query  
> 0.00 0.63 0.00 1 0.00 94.00  
> 0.00 0.63 0.00 9 0.00 0.00 Module#class\_eval  
> 0.00 0.63 0.00 13 0.00 0.00 IO#write  
> 0.00 0.63 0.00 355 0.00 0.00 Hash#[]  
> 0.00 0.63 0.00 4 0.00 0.00  
> Gem::Specification#attribute\_alias\_singular  
> 0.00 0.63 0.00 2 0.00 0.00 Regexp#initialize  
> 0.00 0.64 0.00 1 0.00 641.00 #toplevel

You are using gems on windows. compare the function lists. Set RUBYOPT  
to empty string before running the program (in a cmd session):

set RUBYOPT=  
ruby -r profile prog

---

<div class="post-metadata">

**Author:** ![Luan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/b9bd4f/32.png) [@Luan](https://www.ruby-forum.com/u/Luan)\
**Post date:** [November 29, 2006, 7:12pm UTC](https://www.ruby-forum.com/t/ruby-profile-gave-different-result-in-windows-and-linux/77681/3 "2006-11-29T19:12:26Z")

</div>

On 11/29/06, Luan [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hi All,
> 
> I am using “ruby -r profile prog” for the same program between Windows and  
> Linux.

Make sure your RUBYOPT environment variable is the same on both  
systems. Looks like the Windows version is using RubyGems, and the  
Linux version is not.
