Why is Ruby on Linux so much faster than on Windows?

Hi List,

I’m currently investigating some possibilities for deplyong my Rails
app.
I developed it on Windows XP, but I thought I should give linux a run
too.
I expected some performance benefit, but not of this level.

See the table for the measurments, all taken from the log by clicking
5 times on the same method.

PC = old pc, Athlon xp 1800, 512 MB, 7200 rmp HD, Win XP
Laptop-WinXP = Intel Centrino 1.5Ghz, 512MB, 4200 rmp HD, Win XP
Laptop-Ubuntu = same laptop, but now with Ubuntu 7.04 Beta

All tests were run in development mode, with webrick 1.3.1, mysql
configured just the same:

PC-WINXP LAPTOP-WINXP LAPTOP-UBUNTU
(first test)
0,27 0,5 0,12
0,24 0,49 0,09
0,95 0,26 0,09
0,25 0,68 0,88
1,14 0,28 0,2

(second test)
0,72 0,43 0,29
0,61 0,43 0,14
1,28 0,25 0,25
0,41 0,57 0,25
0,83 0,3 0,13

Can anyone explain me why Rails or Ruby is that much faster on ubuntu?

Some people claim that linux is faster than windows, i don’t have
technical base to say that, maybe even those who claim that.

Also, linux doesn’t need graphical interface, and grafical interfaces
consume CPU cycles too, Linus and UNIX where created to have simple
design.

here is a text talking about Linux vs. Windows performance.
http://blogs.ittoolbox.com/linux/locutus/archives/why-linux-still-runs-faster-than-windows-14828

you can find more with google

Ruby in general isn’t any noticeable slower on Windows than it is on
Linux, but Windows in general is much slower in file operations, and so
it is with Ruby. A Rails application uses many files, and hence the
slowdown.

Roderick

Were they both fresh installs of the operating system? If not that
could easily explain it. Because I WinXP primarily it has tons of
‘junk’ on it. I try to keep my linux stuff as clean as possible
(though I’m not very good at it because I’m still learning linux). I’m
pretty sure that most linux distros are pretty lean after the initial
installation, even Ubuntu. At least they are compared to Windows. I
guess that could explain it too.

Phlip wrote:

If I get a flash memory USB stick and mount it (WinXP or Linux), will
it read and write files faster than those little spinning platters inside a
hard drive?

Usually, flash memory has lower read latency (which is good) but also
lower throughput and higher read latency. Separate from these physical
characteristics you also need to figure in the overhead from the USB
port that usually is fairly CPU costly.

So it depends. Rails performs a lot of smallish reads but also does a
fair amount of log writes.
In all I’d still prefer the hard drive performance-wise, but I don’t
have the numbers to back it up.

Roderick

Roderick van Domburg wrote:

Ruby in general isn’t any noticeable slower on Windows than it is on
Linux, but Windows in general is much slower in file operations, and so
it is with Ruby. A Rails application uses many files, and hence the
slowdown.

Here’s a newb question that shows how well I keep with the times.

If I get a flash memory USB stick and mount it (WinXP or Linux), will
it
read and write files faster than those little spinning platters inside a
hard drive?

It seems there are those who put their entire project, Apache, Ruby,
Rails,
SVN and everything onto those things…


Phlip
"Pigleg too?", week 1