From: Peter Zotov Date: 2012-07-03T09:27:10+09:00 Subject: Re: ruby performance Dan Connelly писал 03.07.2012 04:06: > I should provide version numbers... the RHEL on work machines is > pretty > backwards. > > Ruby: 1.8.1 > Perl: 5.8.8 1.8.1?!! That's just ancient. I doubt it's compatible with any recent gems. It seems that you need at least 1.8.6 even for the most compatible of them. > > I ran on my personal Macbook Air with Ruby 1.9.3 and Perl 5.10, and > Perl > was only 2x faster. So it seems Ruby 1.9 is indeed substantially > faster > (assuming Perl is fairly stable). > > Curious when I did the loop in C how huge the speed increase was with > -O1 versus -O0... > > #include > int main(void) { > int i = 0; > while (++i < 10000000); > printf("i = %d", i); > return 0; > } > > but that's a bit off-topic... I don't know your precise GCC version so I won't comment on any particular optimization details my GCC version does, but I'd advise you to read the relevant assembly. The change could be anything from binding `i' to a register to pre-computing the entire loop (yeah, recent GCC can do that.) -- WBR, Peter Zotov.