# Ruby Script Under performance in CYGWIN environment

**URL:** <https://www.ruby-forum.com/t/ruby-script-under-performance-in-cygwin-environment/127314>\
**Category:** Ruby\
**Created:** [January 28, 2008, 4:10am UTC](https://www.ruby-forum.com/t/ruby-script-under-performance-in-cygwin-environment/127314 "2008-01-28T04:10:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ankit](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/cab0a1/32.png) [@ankit](https://www.ruby-forum.com/u/ankit)\
**Post date:** [January 28, 2008, 4:10am UTC](https://www.ruby-forum.com/t/ruby-script-under-performance-in-cygwin-environment/127314/1 "2008-01-28T04:10:53Z")

</div>

Hi,

I have written one ruby script to execute the regression testcases.  
There are more than five thousand of testcases to be run daily.

For Linux, the performance was ok and on expected line but on CYGWIN  
shell, the script is taking a lot more time ( I would say almost  
double of time) in running the same testcases as compared to similar  
script written in perl.

Is ruby under performance is related and specific to cygwin shell or  
is ruby not meant at all to be run on windows and this is known  
performance issue?

I am using the following : CYGWIN\_NT-5.1 and ruby 1.8.4

regards,  
Ankit

---

<div class="post-metadata">

**Author:** ![ankit](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/cab0a1/32.png) [@ankit](https://www.ruby-forum.com/u/ankit)\
**Post date:** [January 28, 2008, 6:25pm UTC](https://www.ruby-forum.com/t/ruby-script-under-performance-in-cygwin-environment/127314/2 "2008-01-28T18:25:41Z")

</div>

On 28.01.2008 05:02, M. Edward (Ed) Borasky wrote:

> ankit wrote:
> 
> > I have written one ruby script to execute the regression testcases.  
> > There are more than five thousand of testcases to be run daily.

What do these test cases do? Is there any IO involved other than  
reading the code? What else is going on on that box? Is it similar  
hardware? …

> > For Linux, the performance was ok and on expected line but on CYGWIN  
> > shell, the script is taking a lot more time ( I would say almost  
> > double of time) in running the same testcases as compared to similar  
> > script written in perl.
> > 
> > Is ruby under performance is related and specific to cygwin shell or  
> > is ruby not meant at all to be run on windows and this is known  
> > performance issue?

Of course it is meant to be run on Windows - otherwise there would be no  
point in having a cygwin package, would it? I am running my Ruby  
scripts on cygwin for quite some time now and do not encounter any  
issues.

> > I am using the following : CYGWIN\_NT-5.1 and ruby 1.8.4

Since you are giving no hard facts its difficult to answer. I tend to  
believe that the cygwin version might be slower but haven’t measured  
myself and certainly would not expect a factor of two on the same  
hardware. /Did/ you test on the same hardware?

First of all I would to some measurements to have hard facts. Maybe a  
simple command line loop like

Robert@Babelfish2 ~  
$ ruby -e ‘t=Time.now;5\_000\_000.times {};p(Time.now-t)’  
2.031

> 1.8.4 you have now.  
> I doubt that the OP will be satisfied with a 10% improvement. Btw, the  
> current version is not 1.8.4:

Robert@Babelfish2 ~  
$ ruby -v  
ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-cygwin]

Robert@Babelfish2 ~  
$ uname -a  
CYGWIN\_NT-5.1 Babelfish2 1.5.25(0.156/4/2) 2007-12-14 19:21 i686 Cygwin

Kind regards

robert

---

<div class="post-metadata">

**Author:** ![ankit](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/cab0a1/32.png) [@ankit](https://www.ruby-forum.com/u/ankit)\
**Post date:** [January 28, 2008, 5:03am UTC](https://www.ruby-forum.com/t/ruby-script-under-performance-in-cygwin-environment/127314/3 "2008-01-28T05:03:07Z")

</div>

ankit wrote:

> Is ruby under performance is related and specific to cygwin shell or  
> is ruby not meant at all to be run on windows and this is known  
> performance issue?
> 
> I am using the following : CYGWIN\_NT-5.1 and ruby 1.8.4
> 
> regards,  
> Ankit

Download the Ruby source (1.8.6) and recompile it on Cygwin using the  
following CFLAGS

export CFLAGS=’-O3 -march=’

For example, if you’re running a Pentium 4, do

export CFLAGS=’-O3 -march=pentium4’

That will give you at least a 10 percent improvement over the base Ruby  
1.8.4 you have now.

---

<div class="post-metadata">

**Author:** ![ankit](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/cab0a1/32.png) [@ankit](https://www.ruby-forum.com/u/ankit)\
**Post date:** [January 28, 2008, 8:44pm UTC](https://www.ruby-forum.com/t/ruby-script-under-performance-in-cygwin-environment/127314/4 "2008-01-28T20:44:52Z")

</div>

Robert K. wrote:

> I doubt that the OP will be satisfied with a 10% improvement. Btw, the  
> current version is not 1.8.4:
> 
> Robert@Babelfish2 ~  
> $ ruby -v  
> ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-cygwin]

I suspected that but didn’t have my Cygwin system handy. The operative  
factor here is that “i386”. I have no idea what compiler the Cygwin  
people used to build that Ruby or what optimization flags they used, but  
I do know that i386 is the lowest common denominator. That is  
unfortunately also the case for RHEL, Debian and Ubuntu, and probably  
also the case for Fedora. I think the One-Click installer has more  
optimization.
