Has anyone else seen this behavior?I created a simple Ruby script for giggles to see how fast it would count up on a couple machines I have. Here's the source:    for n in 1...1000000 do        puts #{n}endI ran the script using time ruby ./rubytest.rbOn my not-newest-generation MacBook, running this locally took about 15 seconds.If I SSH from work to my MacBook and run it over that SSH session (over the Internet), it takes nearly 55 seconds.If I use ssh localhost on my MacBook, from the local console, running the script takes about 10 seconds.Questions: Do Ruby scripts somehow get blocked when dumping output to a console, so it is slowed down when pumping data to a remote terminal? Does SSH compress a connection, so that when I SSH'd in locally the script was faster because it was compressing the display of data fast enough that even with the compression overhead the script could run faster because it was somehow acknowledging the output faster?
Time running a Ruby script is different locally than over SSH
ssh;time;ruby
It's because you're echoing all the numbers out to the screen via the puts. These then have to be sent over the SSH connection which extends the amount of time the scripts takes to run. The output is also buffered locally but the effects aren't as noticeable.You can confirm this by dumping all the output to a file instead.Exampleslocal on laptop to screen$ time ruby r.rbreal    0m19.474suser    0m3.236ssys     0m3.207slocal on laptop to file$ time ruby r.rb >& rb_local.txtreal    0m0.785suser    0m0.760ssys     0m0.020sSSH to desktop to screen$ time ruby r.rbreal    0m18.026suser    0m4.118ssys     0m3.815sSSH to desktop to file$ time ruby r.rb >& rb_remote.txtreal    0m3.942suser    0m3.036ssys     0m0.741sWhen writing scripts such as this its generally a good idea to dump the contents to a file instead and then use a tool such as tail to watch the file periodically.NOTE: The notation >& will redirect both STDERR and STDOUT to the .txt files. However the output from time will still get displayed to the console. This notation is equivalent to cmd > some_file.txt 2>&1.