<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Samson&#039;s Weblog &#187; Performance</title>
	<atom:link href="http://blog.samsonis.me/tag/performance/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.samsonis.me</link>
	<description>天与弗取，反受其咎；时至不行，反受其殃</description>
	<lastBuildDate>Sun, 29 Jan 2012 13:53:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>List performance: ruby 1.8 and 1.9 (Part 2)</title>
		<link>http://blog.samsonis.me/2010/02/list-performance-ruby-1-8-and-1-9-part-2/</link>
		<comments>http://blog.samsonis.me/2010/02/list-performance-ruby-1-8-and-1-9-part-2/#comments</comments>
		<pubDate>Mon, 22 Feb 2010 05:54:36 +0000</pubDate>
		<dc:creator>Samson Wu</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Technique]]></category>
		<category><![CDATA[Performance]]></category>

		<guid isPermaLink="false">http://blog.samsonis.me/?p=1654</guid>
		<description><![CDATA[接上篇： List performance: ruby 1.8 and 1.9 (Part 1) 有了之前的准备和热身，真正跑起步来似乎轻松不少，先贴上我们用来benchmark的code： require 'benchmark' n = ARGV.empty? ? 10 ** 6 : 10 ** ARGV&#91;0&#93;.to_i puts &#34;n=#{n}&#34; Benchmark.bmbm do &#124;x&#124; &#160; x.report do &#160; &#160; list = &#91;&#93; &#160; &#160; n.times do &#160; &#160; &#160; list &#60;&#60; 0 &#160; &#160; end &#160; end end 和之前用来benchmark loop performance的code结构上基本没有区别，这里不再赘述，具体的解释亦可参照前文。 ...]]></description>
			<content:encoded><![CDATA[<p>接上篇： <a href="http://blog.samsonis.me/2010/02/list-performance-ruby-1-8-and-1-9-part-1/">List performance: ruby 1.8 and 1.9 (Part 1)</a></p>
<p>有了之前的准备和热身，真正跑起步来似乎轻松不少，先贴上我们用来benchmark的code：</p>
<div class="codecolorer-container ruby railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'benchmark'</span><br />
<br />
n = ARGV.<span style="color:#9900CC;">empty</span>? ? <span style="color:#006666;">10</span> <span style="color:#006600; font-weight:bold;">**</span> <span style="color:#006666;">6</span> : <span style="color:#006666;">10</span> <span style="color:#006600; font-weight:bold;">**</span> ARGV<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">to_i</span><br />
<span style="color:#CC0066; font-weight:bold;">puts</span> <span style="color:#996600;">&quot;n=#{n}&quot;</span><br />
<span style="color:#CC00FF; font-weight:bold;">Benchmark</span>.<span style="color:#9900CC;">bmbm</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>x<span style="color:#006600; font-weight:bold;">|</span><br />
&nbsp; x.<span style="color:#9900CC;">report</span> <span style="color:#9966CC; font-weight:bold;">do</span><br />
&nbsp; &nbsp; list = <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#93;</span><br />
&nbsp; &nbsp; n.<span style="color:#9900CC;">times</span> <span style="color:#9966CC; font-weight:bold;">do</span><br />
&nbsp; &nbsp; &nbsp; list <span style="color:#006600; font-weight:bold;">&lt;&lt;</span> <span style="color:#006666;">0</span><br />
&nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
&nbsp; <span style="color:#9966CC; font-weight:bold;">end</span><br />
<span style="color:#9966CC; font-weight:bold;">end</span></div></div>
<p>和<a href="http://blog.samsonis.me/2010/02/list-performance-ruby-1-8-and-1-9-part-1/#more-1621">之前</a>用来benchmark loop performance的code结构上基本没有区别，这里不再赘述，具体的解释亦可参照前文。<br />
<span id="more-1654"></span><br />
下面分别是ruby 1.8和ruby 1.9的一次完整运行（ n=10~10^8 ）的数据结果（也是我唯一运行的一次…）</p>
<p>ruby 1.8:</p>
<div class="codecolorer-container bash railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;height:300px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #007800;">n</span>=<span style="color: #000000;">10</span><br />
Rehearsal <span style="color: #660033;">------------------------------------</span><br />
&nbsp; &nbsp;<span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.000014</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #660033;">---------------------------</span> total: 0.000000sec<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp;user &nbsp; &nbsp; system &nbsp; &nbsp; &nbsp;total &nbsp; &nbsp; &nbsp; &nbsp;real<br />
&nbsp; &nbsp;<span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.000012</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
==============================================<br />
<br />
<span style="color: #007800;">n</span>=<span style="color: #000000;">100</span><br />
Rehearsal <span style="color: #660033;">------------------------------------</span><br />
&nbsp; &nbsp;<span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.000118</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #660033;">---------------------------</span> total: 0.000000sec<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp;user &nbsp; &nbsp; system &nbsp; &nbsp; &nbsp;total &nbsp; &nbsp; &nbsp; &nbsp;real<br />
&nbsp; &nbsp;<span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.000061</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
==============================================<br />
<br />
<span style="color: #007800;">n</span>=<span style="color: #000000;">1000</span><br />
Rehearsal <span style="color: #660033;">------------------------------------</span><br />
&nbsp; &nbsp;<span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.000375</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #660033;">---------------------------</span> total: 0.000000sec<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp;user &nbsp; &nbsp; system &nbsp; &nbsp; &nbsp;total &nbsp; &nbsp; &nbsp; &nbsp;real<br />
&nbsp; &nbsp;<span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.000314</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
==============================================<br />
<br />
<span style="color: #007800;">n</span>=<span style="color: #000000;">10000</span><br />
Rehearsal <span style="color: #660033;">------------------------------------</span><br />
&nbsp; &nbsp;<span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.002900</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #660033;">---------------------------</span> total: 0.000000sec<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp;user &nbsp; &nbsp; system &nbsp; &nbsp; &nbsp;total &nbsp; &nbsp; &nbsp; &nbsp;real<br />
&nbsp; &nbsp;<span style="color: #000000;">0.010000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.010000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.002790</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
==============================================<br />
<br />
<span style="color: #007800;">n</span>=<span style="color: #000000;">100000</span><br />
Rehearsal <span style="color: #660033;">------------------------------------</span><br />
&nbsp; &nbsp;<span style="color: #000000;">0.030000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.030000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.027712</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #660033;">---------------------------</span> total: 0.030000sec<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp;user &nbsp; &nbsp; system &nbsp; &nbsp; &nbsp;total &nbsp; &nbsp; &nbsp; &nbsp;real<br />
&nbsp; &nbsp;<span style="color: #000000;">0.020000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.020000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.027713</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
==============================================<br />
<br />
<span style="color: #007800;">n</span>=<span style="color: #000000;">1000000</span><br />
Rehearsal <span style="color: #660033;">------------------------------------</span><br />
&nbsp; &nbsp;<span style="color: #000000;">0.280000</span> &nbsp; <span style="color: #000000;">0.010000</span> &nbsp; <span style="color: #000000;">0.290000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.323298</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #660033;">---------------------------</span> total: 0.290000sec<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp;user &nbsp; &nbsp; system &nbsp; &nbsp; &nbsp;total &nbsp; &nbsp; &nbsp; &nbsp;real<br />
&nbsp; &nbsp;<span style="color: #000000;">0.280000</span> &nbsp; <span style="color: #000000;">0.010000</span> &nbsp; <span style="color: #000000;">0.290000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.283621</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
==============================================<br />
<br />
<span style="color: #007800;">n</span>=<span style="color: #000000;">10000000</span><br />
Rehearsal <span style="color: #660033;">------------------------------------</span><br />
&nbsp; &nbsp;<span style="color: #000000;">2.740000</span> &nbsp; <span style="color: #000000;">0.050000</span> &nbsp; <span style="color: #000000;">2.790000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">2.809917</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #660033;">---------------------------</span> total: 2.790000sec<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp;user &nbsp; &nbsp; system &nbsp; &nbsp; &nbsp;total &nbsp; &nbsp; &nbsp; &nbsp;real<br />
&nbsp; &nbsp;<span style="color: #000000;">2.760000</span> &nbsp; <span style="color: #000000;">0.040000</span> &nbsp; <span style="color: #000000;">2.800000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">2.810491</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
==============================================<br />
<br />
<span style="color: #007800;">n</span>=<span style="color: #000000;">100000000</span><br />
Rehearsal <span style="color: #660033;">------------------------------------</span><br />
&nbsp; <span style="color: #000000;">27.410000</span> &nbsp; <span style="color: #000000;">0.490000</span> &nbsp;<span style="color: #000000;">27.900000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #000000;">28.164103</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #660033;">--------------------------</span> total: 27.900000sec<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp;user &nbsp; &nbsp; system &nbsp; &nbsp; &nbsp;total &nbsp; &nbsp; &nbsp; &nbsp;real<br />
&nbsp; <span style="color: #000000;">27.620000</span> &nbsp; <span style="color: #000000;">0.480000</span> &nbsp;<span style="color: #000000;">28.100000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #000000;">28.230073</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
==============================================</div></div>
<p>ruby 1.9:</p>
<div class="codecolorer-container bash railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;height:300px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #007800;">n</span>=<span style="color: #000000;">10</span><br />
Rehearsal <span style="color: #660033;">------------------------------------</span><br />
&nbsp; &nbsp;<span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.000068</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #660033;">---------------------------</span> total: 0.000000sec<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp;user &nbsp; &nbsp; system &nbsp; &nbsp; &nbsp;total &nbsp; &nbsp; &nbsp; &nbsp;real<br />
&nbsp; &nbsp;<span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.000012</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
==============================================<br />
<br />
<span style="color: #007800;">n</span>=<span style="color: #000000;">100</span><br />
Rehearsal <span style="color: #660033;">------------------------------------</span><br />
&nbsp; &nbsp;<span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.000038</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #660033;">---------------------------</span> total: 0.000000sec<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp;user &nbsp; &nbsp; system &nbsp; &nbsp; &nbsp;total &nbsp; &nbsp; &nbsp; &nbsp;real<br />
&nbsp; &nbsp;<span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.000032</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
==============================================<br />
<br />
<span style="color: #007800;">n</span>=<span style="color: #000000;">1000</span><br />
Rehearsal <span style="color: #660033;">------------------------------------</span><br />
&nbsp; &nbsp;<span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.000297</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #660033;">---------------------------</span> total: 0.000000sec<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp;user &nbsp; &nbsp; system &nbsp; &nbsp; &nbsp;total &nbsp; &nbsp; &nbsp; &nbsp;real<br />
&nbsp; &nbsp;<span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.000209</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
==============================================<br />
<br />
<span style="color: #007800;">n</span>=<span style="color: #000000;">10000</span><br />
Rehearsal <span style="color: #660033;">------------------------------------</span><br />
&nbsp; &nbsp;<span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.002164</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #660033;">---------------------------</span> total: 0.000000sec<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp;user &nbsp; &nbsp; system &nbsp; &nbsp; &nbsp;total &nbsp; &nbsp; &nbsp; &nbsp;real<br />
&nbsp; &nbsp;<span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.002025</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
==============================================<br />
<br />
<span style="color: #007800;">n</span>=<span style="color: #000000;">100000</span><br />
Rehearsal <span style="color: #660033;">------------------------------------</span><br />
&nbsp; &nbsp;<span style="color: #000000;">0.020000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.020000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.020366</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #660033;">---------------------------</span> total: 0.020000sec<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp;user &nbsp; &nbsp; system &nbsp; &nbsp; &nbsp;total &nbsp; &nbsp; &nbsp; &nbsp;real<br />
&nbsp; &nbsp;<span style="color: #000000;">0.020000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.020000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.020873</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
==============================================<br />
<br />
<span style="color: #007800;">n</span>=<span style="color: #000000;">1000000</span><br />
Rehearsal <span style="color: #660033;">------------------------------------</span><br />
&nbsp; &nbsp;<span style="color: #000000;">0.190000</span> &nbsp; <span style="color: #000000;">0.010000</span> &nbsp; <span style="color: #000000;">0.200000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.208302</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #660033;">---------------------------</span> total: 0.200000sec<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp;user &nbsp; &nbsp; system &nbsp; &nbsp; &nbsp;total &nbsp; &nbsp; &nbsp; &nbsp;real<br />
&nbsp; &nbsp;<span style="color: #000000;">0.190000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.190000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.208822</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
==============================================<br />
<br />
<span style="color: #007800;">n</span>=<span style="color: #000000;">10000000</span><br />
Rehearsal <span style="color: #660033;">------------------------------------</span><br />
&nbsp; &nbsp;<span style="color: #000000;">1.920000</span> &nbsp; <span style="color: #000000;">0.050000</span> &nbsp; <span style="color: #000000;">1.970000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">2.050276</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #660033;">---------------------------</span> total: 1.970000sec<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp;user &nbsp; &nbsp; system &nbsp; &nbsp; &nbsp;total &nbsp; &nbsp; &nbsp; &nbsp;real<br />
&nbsp; &nbsp;<span style="color: #000000;">1.920000</span> &nbsp; <span style="color: #000000;">0.050000</span> &nbsp; <span style="color: #000000;">1.970000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">2.054335</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
==============================================<br />
<br />
<span style="color: #007800;">n</span>=<span style="color: #000000;">100000000</span><br />
Rehearsal <span style="color: #660033;">------------------------------------</span><br />
&nbsp; <span style="color: #000000;">19.220000</span> &nbsp; <span style="color: #000000;">0.460000</span> &nbsp;<span style="color: #000000;">19.680000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #000000;">20.466960</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #660033;">--------------------------</span> total: 19.680000sec<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp;user &nbsp; &nbsp; system &nbsp; &nbsp; &nbsp;total &nbsp; &nbsp; &nbsp; &nbsp;real<br />
&nbsp; <span style="color: #000000;">19.220000</span> &nbsp; <span style="color: #000000;">0.460000</span> &nbsp;<span style="color: #000000;">19.680000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #000000;">20.546417</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
==============================================</div></div>
<p>就这次运行的结果而言，ruby 1.9的performance平均都有25%～35%的提升，加之<a href="http://blog.samsonis.me/2010/02/list-performance-ruby-1-8-and-1-9-part-1/">Part 1</a>测试过的循环性能的倒退，则更可以确定list append操作的performance确实在1.9里面较1.8有了很大的提高。</p>

	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://blog.samsonis.me/2010/02/list-performance-ruby-1-8-and-1-9-part-1/" title="List performance: ruby 1.8 and 1.9 (Part 1) (February 22, 2010)">List performance: ruby 1.8 and 1.9 (Part 1)</a> (0)</li>
	<li><a href="http://blog.samsonis.me/2011/02/rubygems-1-5-2-manual-upgrade/" title="RubyGems 1.5.2 Manual Upgrade (February 16, 2011)">RubyGems 1.5.2 Manual Upgrade</a> (0)</li>
	<li><a href="http://blog.samsonis.me/2010/02/rubys-python-simplehttpserver/" title="ruby&#8217;s &#8220;python -m SimpleHTTPServer&#8221; (February 21, 2010)">ruby&#8217;s &#8220;python -m SimpleHTTPServer&#8221;</a> (2)</li>
	<li><a href="http://blog.samsonis.me/2010/02/ruby-gem-geoip-and-rack-geoipcountry/" title="Ruby gem geoip and Rack::GeoIPCountry (February 25, 2010)">Ruby gem geoip and Rack::GeoIPCountry</a> (2)</li>
	<li><a href="http://blog.samsonis.me/2011/12/downgrade-rubygems/" title="Downgrade Rubygems (December 5, 2011)">Downgrade Rubygems</a> (0)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://blog.samsonis.me/2010/02/list-performance-ruby-1-8-and-1-9-part-2/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>List performance: ruby 1.8 and 1.9 (Part 1)</title>
		<link>http://blog.samsonis.me/2010/02/list-performance-ruby-1-8-and-1-9-part-1/</link>
		<comments>http://blog.samsonis.me/2010/02/list-performance-ruby-1-8-and-1-9-part-1/#comments</comments>
		<pubDate>Mon, 22 Feb 2010 02:47:02 +0000</pubDate>
		<dc:creator>Samson Wu</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Technique]]></category>
		<category><![CDATA[Performance]]></category>

		<guid isPermaLink="false">http://blog.samsonis.me/?p=1621</guid>
		<description><![CDATA[（本文数据较多，在rss reader里面可能可读性不是很好，可考虑直接在线阅读） 昨天看到pipitu的这篇blog，觉得蛮有意思，文章比较了python和java的list performance，只可惜没有include ruby 1.8和ruby 1.9，不然结论会更有悬念一点，呵呵. 由于无法营造一致的软硬件环境，也不愿意重复pipitu关于python和java部分的工作，这里就只好先简单benchmark（如果可以算是的话）一下ruby 1.8和1.9里的list (array) performance了，也许pipitu以后有空更新include ruby也说不定：） 先看一下我们用的ruby的版本： $ ruby -v ruby 1.8.7 &#40;2009-06-12 patchlevel 174&#41; &#91;i686-darwin9&#93; $ ruby1.9 -v ruby 1.9.1p376 &#40;2009-12-07 revision 26041&#41; &#91;i386-darwin9&#93; 还有os： $ uname -a Darwin macbook.local 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul 15 16:55:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_I386 i386 benchmark的方法和pipitu的python sample类似，就是往空的list里面循环n次append，由于循环也被引入，其performance也值得考虑，因为众所周知ruby里面做一件事犹如孔乙己的茴字写法一样有n种办法，其performance也各不一样，说不定pipitu以后会和python, java进行横向，咱还是挑相对快一点的好～ 不过话说回来，再怎么的精挑细选，java那边还是基本没有悬念，真正有悬念的，我们都心知肚明，呵呵。 所以真正运动之前先来点热身运动，看看哪个循环在我这相对要快： ...]]></description>
			<content:encoded><![CDATA[<p>（本文数据较多，在rss reader里面可能可读性不是很好，可考虑直接<a href="http://blog.samsonis.me/2010/02/list-performance-ruby-1-8-and-1-9-part-1/">在线</a>阅读）</p>
<p>昨天看到<a href="http://pipitu.org/">pipitu</a>的<a href="http://pipitu.org/2010/02/20/list-performance-python-vs-java/">这篇blog</a>，觉得蛮有意思，文章比较了python和java的list performance，只可惜没有include ruby 1.8和ruby 1.9，不然结论会更有悬念一点，呵呵.</p>
<p>由于无法营造一致的软硬件环境，也不愿意重复pipitu关于python和java部分的工作，这里就只好先简单benchmark（如果可以算是的话）一下ruby 1.8和1.9里的list (array) performance了，也许pipitu以后有空更新include ruby也说不定：）</p>
<p>先看一下我们用的ruby的版本：</p>
<div class="codecolorer-container bash railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ ruby <span style="color: #660033;">-v</span><br />
ruby 1.8.7 <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">2009</span>-06-<span style="color: #000000;">12</span> patchlevel <span style="color: #000000;">174</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>i686-darwin9<span style="color: #7a0874; font-weight: bold;">&#93;</span></div></div>
<div class="codecolorer-container bash railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ ruby1.9 <span style="color: #660033;">-v</span><br />
ruby 1.9.1p376 <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">2009</span>-<span style="color: #000000;">12</span>-07 revision <span style="color: #000000;">26041</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>i386-darwin9<span style="color: #7a0874; font-weight: bold;">&#93;</span></div></div>
<p>还有os：</p>
<div class="codecolorer-container bash railscasts" style="border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span style="color: #c20cb9; font-weight: bold;">uname</span> <span style="color: #660033;">-a</span><br />
Darwin macbook.local 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul <span style="color: #000000;">15</span> <span style="color: #000000;">16</span>:<span style="color: #000000;">55</span>:01 PDT <span style="color: #000000;">2009</span>; root:xnu-1228.15.4~<span style="color: #000000;">1</span><span style="color: #000000; font-weight: bold;">/</span>RELEASE_I386 i386</div></div>
<p><span id="more-1621"></span><br />
benchmark的方法和pipitu的python sample类似，就是往空的list里面循环n次append，由于循环也被引入，其performance也值得考虑，因为众所周知ruby里面做一件事犹如孔乙己的茴字写法一样有n种办法，其performance也各不一样，说不定pipitu以后会和python, java进行横向，咱还是挑相对快一点的好～  不过话说回来，再怎么的精挑细选，java那边还是基本没有悬念，真正有悬念的，我们都心知肚明，呵呵。</p>
<p>所以真正运动之前先来点热身运动，看看哪个循环在我这相对要快：</p>
<div class="codecolorer-container ruby railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'benchmark'</span><br />
<br />
n = ARGV.<span style="color:#9900CC;">empty</span>? ? <span style="color:#006666;">10</span> <span style="color:#006600; font-weight:bold;">**</span> <span style="color:#006666;">6</span> : <span style="color:#006666;">10</span> <span style="color:#006600; font-weight:bold;">**</span> ARGV<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">to_i</span><br />
<span style="color:#CC0066; font-weight:bold;">puts</span> <span style="color:#996600;">&quot;n=#{n}&quot;</span><br />
<span style="color:#CC00FF; font-weight:bold;">Benchmark</span>.<span style="color:#9900CC;">bmbm</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>b<span style="color:#006600; font-weight:bold;">|</span><br />
&nbsp; b.<span style="color:#9900CC;">report</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;for:&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span> &nbsp; &nbsp;<span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#9966CC; font-weight:bold;">for</span> i <span style="color:#9966CC; font-weight:bold;">in</span> 1..<span style="color:#9900CC;">n</span> &nbsp;; a = <span style="color:#996600;">&quot;0&quot;</span>; <span style="color:#9966CC; font-weight:bold;">end</span> <span style="color:#006600; font-weight:bold;">&#125;</span><br />
&nbsp; b.<span style="color:#9900CC;">report</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;times:&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span> &nbsp;<span style="color:#006600; font-weight:bold;">&#123;</span> n.<span style="color:#9900CC;">times</span> <span style="color:#9966CC; font-weight:bold;">do</span> &nbsp; &nbsp; ; a = <span style="color:#996600;">&quot;0&quot;</span>; <span style="color:#9966CC; font-weight:bold;">end</span> <span style="color:#006600; font-weight:bold;">&#125;</span><br />
&nbsp; b.<span style="color:#9900CC;">report</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;upto:&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span> &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span> 1.<span style="color:#9900CC;">upto</span><span style="color:#006600; font-weight:bold;">&#40;</span>n<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span> &nbsp; ; a = <span style="color:#996600;">&quot;0&quot;</span>; <span style="color:#9966CC; font-weight:bold;">end</span> <span style="color:#006600; font-weight:bold;">&#125;</span><br />
&nbsp; b.<span style="color:#9900CC;">report</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;downto:&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> n.<span style="color:#9900CC;">downto</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">1</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span> ; a = <span style="color:#996600;">&quot;0&quot;</span>; <span style="color:#9966CC; font-weight:bold;">end</span> <span style="color:#006600; font-weight:bold;">&#125;</span><br />
<span style="color:#9966CC; font-weight:bold;">end</span></div></div>
<p>以上是我所想到的比较常见的4种茴字写法，程序默认取n=10^6进行循环，也可以接受一个作为幂指数的命令行参数，Benchmark的bmbm方法会先dry run一遍所有test作为rehearsal，等memory和garbage collection的状态相对stable了以后才进行真正的benchmark，这样先运行和后运行的report会相对公平一点。</p>
<p>默认运行（ n=10^6 ）的结果如下：</p>
<div class="codecolorer-container bash railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #007800;">n</span>=<span style="color: #000000;">1000000</span><br />
Rehearsal <span style="color: #660033;">-------------------------------------------</span><br />
<span style="color: #000000; font-weight: bold;">for</span>: &nbsp; &nbsp; &nbsp;<span style="color: #000000;">0.310000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.310000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.313392</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #7a0874; font-weight: bold;">times</span>: &nbsp; &nbsp;<span style="color: #000000;">0.290000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.290000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.297268</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
upto: &nbsp; &nbsp; <span style="color: #000000;">0.300000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.300000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.300311</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
downto: &nbsp; <span style="color: #000000;">0.310000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.310000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.304146</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #660033;">----------------------------------</span> total: 1.210000sec<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; user &nbsp; &nbsp; system &nbsp; &nbsp; &nbsp;total &nbsp; &nbsp; &nbsp; &nbsp;real<br />
<span style="color: #000000; font-weight: bold;">for</span>: &nbsp; &nbsp; &nbsp;<span style="color: #000000;">0.310000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.310000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.313129</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #7a0874; font-weight: bold;">times</span>: &nbsp; &nbsp;<span style="color: #000000;">0.290000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.290000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.297470</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
upto: &nbsp; &nbsp; <span style="color: #000000;">0.300000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.300000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.302154</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
downto: &nbsp; <span style="color: #000000;">0.310000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.310000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.305562</span><span style="color: #7a0874; font-weight: bold;">&#41;</span></div></div>
<p>一次完整运行（ n=10~10^8 ）的数据结果如下：</p>
<div class="codecolorer-container bash railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;height:300px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #007800;">n</span>=<span style="color: #000000;">10</span><br />
Rehearsal <span style="color: #660033;">-------------------------------------------</span><br />
<span style="color: #000000; font-weight: bold;">for</span>: &nbsp; &nbsp; &nbsp;<span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.000018</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #7a0874; font-weight: bold;">times</span>: &nbsp; &nbsp;<span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.000011</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
upto: &nbsp; &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.000047</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
downto: &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.000053</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #660033;">----------------------------------</span> total: 0.000000sec<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; user &nbsp; &nbsp; system &nbsp; &nbsp; &nbsp;total &nbsp; &nbsp; &nbsp; &nbsp;real<br />
<span style="color: #000000; font-weight: bold;">for</span>: &nbsp; &nbsp; &nbsp;<span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.000014</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #7a0874; font-weight: bold;">times</span>: &nbsp; &nbsp;<span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.000011</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
upto: &nbsp; &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.000011</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
downto: &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.000011</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
=====================================================<br />
<br />
<span style="color: #007800;">n</span>=<span style="color: #000000;">100</span><br />
Rehearsal <span style="color: #660033;">-------------------------------------------</span><br />
<span style="color: #000000; font-weight: bold;">for</span>: &nbsp; &nbsp; &nbsp;<span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.000041</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #7a0874; font-weight: bold;">times</span>: &nbsp; &nbsp;<span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.000031</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
upto: &nbsp; &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.000033</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
downto: &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.000040</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #660033;">----------------------------------</span> total: 0.000000sec<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; user &nbsp; &nbsp; system &nbsp; &nbsp; &nbsp;total &nbsp; &nbsp; &nbsp; &nbsp;real<br />
<span style="color: #000000; font-weight: bold;">for</span>: &nbsp; &nbsp; &nbsp;<span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.000035</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #7a0874; font-weight: bold;">times</span>: &nbsp; &nbsp;<span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.000030</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
upto: &nbsp; &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.000031</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
downto: &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.000031</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
=====================================================<br />
<br />
<span style="color: #007800;">n</span>=<span style="color: #000000;">1000</span><br />
Rehearsal <span style="color: #660033;">-------------------------------------------</span><br />
<span style="color: #000000; font-weight: bold;">for</span>: &nbsp; &nbsp; &nbsp;<span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.000367</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #7a0874; font-weight: bold;">times</span>: &nbsp; &nbsp;<span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.000315</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
upto: &nbsp; &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.000319</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
downto: &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.000854</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #660033;">----------------------------------</span> total: 0.000000sec<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; user &nbsp; &nbsp; system &nbsp; &nbsp; &nbsp;total &nbsp; &nbsp; &nbsp; &nbsp;real<br />
<span style="color: #000000; font-weight: bold;">for</span>: &nbsp; &nbsp; &nbsp;<span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.000273</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #7a0874; font-weight: bold;">times</span>: &nbsp; &nbsp;<span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.000250</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
upto: &nbsp; &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.000254</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
downto: &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.000258</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
=====================================================<br />
<br />
<span style="color: #007800;">n</span>=<span style="color: #000000;">10000</span><br />
Rehearsal <span style="color: #660033;">-------------------------------------------</span><br />
<span style="color: #000000; font-weight: bold;">for</span>: &nbsp; &nbsp; &nbsp;<span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.003388</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #7a0874; font-weight: bold;">times</span>: &nbsp; &nbsp;<span style="color: #000000;">0.010000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.010000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.003056</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
upto: &nbsp; &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.003006</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
downto: &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.003084</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #660033;">----------------------------------</span> total: 0.010000sec<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; user &nbsp; &nbsp; system &nbsp; &nbsp; &nbsp;total &nbsp; &nbsp; &nbsp; &nbsp;real<br />
<span style="color: #000000; font-weight: bold;">for</span>: &nbsp; &nbsp; &nbsp;<span style="color: #000000;">0.010000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.010000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.003114</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #7a0874; font-weight: bold;">times</span>: &nbsp; &nbsp;<span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.002955</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
upto: &nbsp; &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.003047</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
downto: &nbsp; <span style="color: #000000;">0.010000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.010000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.004650</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
=====================================================<br />
<br />
<span style="color: #007800;">n</span>=<span style="color: #000000;">100000</span><br />
Rehearsal <span style="color: #660033;">-------------------------------------------</span><br />
<span style="color: #000000; font-weight: bold;">for</span>: &nbsp; &nbsp; &nbsp;<span style="color: #000000;">0.030000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.030000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.032892</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #7a0874; font-weight: bold;">times</span>: &nbsp; &nbsp;<span style="color: #000000;">0.030000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.030000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.029808</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
upto: &nbsp; &nbsp; <span style="color: #000000;">0.030000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.030000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.031190</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
downto: &nbsp; <span style="color: #000000;">0.030000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.030000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.030379</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #660033;">----------------------------------</span> total: 0.120000sec<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; user &nbsp; &nbsp; system &nbsp; &nbsp; &nbsp;total &nbsp; &nbsp; &nbsp; &nbsp;real<br />
<span style="color: #000000; font-weight: bold;">for</span>: &nbsp; &nbsp; &nbsp;<span style="color: #000000;">0.030000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.030000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.033382</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #7a0874; font-weight: bold;">times</span>: &nbsp; &nbsp;<span style="color: #000000;">0.030000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.030000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.029139</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
upto: &nbsp; &nbsp; <span style="color: #000000;">0.030000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.030000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.031608</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
downto: &nbsp; <span style="color: #000000;">0.030000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.030000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.030498</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
=====================================================<br />
<br />
<span style="color: #007800;">n</span>=<span style="color: #000000;">1000000</span><br />
Rehearsal <span style="color: #660033;">-------------------------------------------</span><br />
<span style="color: #000000; font-weight: bold;">for</span>: &nbsp; &nbsp; &nbsp;<span style="color: #000000;">0.310000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.310000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.313392</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #7a0874; font-weight: bold;">times</span>: &nbsp; &nbsp;<span style="color: #000000;">0.290000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.290000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.297268</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
upto: &nbsp; &nbsp; <span style="color: #000000;">0.300000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.300000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.300311</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
downto: &nbsp; <span style="color: #000000;">0.310000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.310000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.304146</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #660033;">----------------------------------</span> total: 1.210000sec<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; user &nbsp; &nbsp; system &nbsp; &nbsp; &nbsp;total &nbsp; &nbsp; &nbsp; &nbsp;real<br />
<span style="color: #000000; font-weight: bold;">for</span>: &nbsp; &nbsp; &nbsp;<span style="color: #000000;">0.310000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.310000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.313129</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #7a0874; font-weight: bold;">times</span>: &nbsp; &nbsp;<span style="color: #000000;">0.290000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.290000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.297470</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
upto: &nbsp; &nbsp; <span style="color: #000000;">0.300000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.300000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.302154</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
downto: &nbsp; <span style="color: #000000;">0.310000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.310000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.305562</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
=====================================================<br />
<br />
<span style="color: #007800;">n</span>=<span style="color: #000000;">10000000</span><br />
Rehearsal <span style="color: #660033;">-------------------------------------------</span><br />
<span style="color: #000000; font-weight: bold;">for</span>: &nbsp; &nbsp; &nbsp;<span style="color: #000000;">3.090000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">3.090000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">3.109693</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #7a0874; font-weight: bold;">times</span>: &nbsp; &nbsp;<span style="color: #000000;">2.940000</span> &nbsp; <span style="color: #000000;">0.010000</span> &nbsp; <span style="color: #000000;">2.950000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">2.946662</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
upto: &nbsp; &nbsp; <span style="color: #000000;">2.990000</span> &nbsp; <span style="color: #000000;">0.010000</span> &nbsp; <span style="color: #000000;">3.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">3.003812</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
downto: &nbsp; <span style="color: #000000;">3.010000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">3.010000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">3.021900</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #660033;">---------------------------------</span> total: 12.050000sec<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; user &nbsp; &nbsp; system &nbsp; &nbsp; &nbsp;total &nbsp; &nbsp; &nbsp; &nbsp;real<br />
<span style="color: #000000; font-weight: bold;">for</span>: &nbsp; &nbsp; &nbsp;<span style="color: #000000;">3.110000</span> &nbsp; <span style="color: #000000;">0.010000</span> &nbsp; <span style="color: #000000;">3.120000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">3.119928</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #7a0874; font-weight: bold;">times</span>: &nbsp; &nbsp;<span style="color: #000000;">2.950000</span> &nbsp; <span style="color: #000000;">0.010000</span> &nbsp; <span style="color: #000000;">2.960000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">2.992141</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
upto: &nbsp; &nbsp; <span style="color: #000000;">3.000000</span> &nbsp; <span style="color: #000000;">0.010000</span> &nbsp; <span style="color: #000000;">3.010000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">3.044853</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
downto: &nbsp; <span style="color: #000000;">3.020000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">3.020000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">3.036987</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
=====================================================<br />
<br />
<span style="color: #007800;">n</span>=<span style="color: #000000;">100000000</span><br />
Rehearsal <span style="color: #660033;">-------------------------------------------</span><br />
<span style="color: #000000; font-weight: bold;">for</span>: &nbsp; &nbsp; <span style="color: #000000;">30.950000</span> &nbsp; <span style="color: #000000;">0.070000</span> &nbsp;<span style="color: #000000;">31.020000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #000000;">31.139756</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #7a0874; font-weight: bold;">times</span>: &nbsp; <span style="color: #000000;">29.360000</span> &nbsp; <span style="color: #000000;">0.060000</span> &nbsp;<span style="color: #000000;">29.420000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #000000;">29.543839</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
upto: &nbsp; &nbsp;<span style="color: #000000;">29.890000</span> &nbsp; <span style="color: #000000;">0.070000</span> &nbsp;<span style="color: #000000;">29.960000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #000000;">30.102346</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
downto: &nbsp;<span style="color: #000000;">30.080000</span> &nbsp; <span style="color: #000000;">0.070000</span> &nbsp;<span style="color: #000000;">30.150000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #000000;">30.271642</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #660033;">--------------------------------</span> total: 120.550000sec<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; user &nbsp; &nbsp; system &nbsp; &nbsp; &nbsp;total &nbsp; &nbsp; &nbsp; &nbsp;real<br />
<span style="color: #000000; font-weight: bold;">for</span>: &nbsp; &nbsp; <span style="color: #000000;">31.130000</span> &nbsp; <span style="color: #000000;">0.080000</span> &nbsp;<span style="color: #000000;">31.210000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #000000;">31.359814</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #7a0874; font-weight: bold;">times</span>: &nbsp; <span style="color: #000000;">29.420000</span> &nbsp; <span style="color: #000000;">0.050000</span> &nbsp;<span style="color: #000000;">29.470000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #000000;">29.630556</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
upto: &nbsp; &nbsp;<span style="color: #000000;">30.050000</span> &nbsp; <span style="color: #000000;">0.060000</span> &nbsp;<span style="color: #000000;">30.110000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #000000;">30.197589</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
downto: &nbsp;<span style="color: #000000;">30.180000</span> &nbsp; <span style="color: #000000;">0.050000</span> &nbsp;<span style="color: #000000;">30.230000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #000000;">30.361343</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
=====================================================</div></div>
<p>由于精力有限，就不做多次运行取平均值这种相对无聊的事情了，结果虽然不严谨也无法真正判断出究竟谁最快（times和upto，downto是在伯仲之间），但至少可以看出for in range是相对最慢的。</p>
<p>换ruby1.9后的运行结果与上基本一致，详细数据如下：</p>
<div class="codecolorer-container bash railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;height:300px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #007800;">n</span>=<span style="color: #000000;">10</span><br />
Rehearsal <span style="color: #660033;">-------------------------------------------</span><br />
<span style="color: #000000; font-weight: bold;">for</span>: &nbsp; &nbsp; &nbsp;<span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.000029</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #7a0874; font-weight: bold;">times</span>: &nbsp; &nbsp;<span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.000050</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
upto: &nbsp; &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.000014</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
downto: &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.000013</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #660033;">----------------------------------</span> total: 0.000000sec<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; user &nbsp; &nbsp; system &nbsp; &nbsp; &nbsp;total &nbsp; &nbsp; &nbsp; &nbsp;real<br />
<span style="color: #000000; font-weight: bold;">for</span>: &nbsp; &nbsp; &nbsp;<span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.000014</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #7a0874; font-weight: bold;">times</span>: &nbsp; &nbsp;<span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.000011</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
upto: &nbsp; &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.000012</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
downto: &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.000012</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
=====================================================<br />
<br />
<span style="color: #007800;">n</span>=<span style="color: #000000;">100</span><br />
Rehearsal <span style="color: #660033;">-------------------------------------------</span><br />
<span style="color: #000000; font-weight: bold;">for</span>: &nbsp; &nbsp; &nbsp;<span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.000061</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #7a0874; font-weight: bold;">times</span>: &nbsp; &nbsp;<span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.000103</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
upto: &nbsp; &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.000078</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
downto: &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.000060</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #660033;">----------------------------------</span> total: 0.000000sec<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; user &nbsp; &nbsp; system &nbsp; &nbsp; &nbsp;total &nbsp; &nbsp; &nbsp; &nbsp;real<br />
<span style="color: #000000; font-weight: bold;">for</span>: &nbsp; &nbsp; &nbsp;<span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.000066</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #7a0874; font-weight: bold;">times</span>: &nbsp; &nbsp;<span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.000061</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
upto: &nbsp; &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.000061</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
downto: &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.000061</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
=====================================================<br />
<br />
<span style="color: #007800;">n</span>=<span style="color: #000000;">1000</span><br />
Rehearsal <span style="color: #660033;">-------------------------------------------</span><br />
<span style="color: #000000; font-weight: bold;">for</span>: &nbsp; &nbsp; &nbsp;<span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.000465</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #7a0874; font-weight: bold;">times</span>: &nbsp; &nbsp;<span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.000461</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
upto: &nbsp; &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.000477</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
downto: &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.000428</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #660033;">----------------------------------</span> total: 0.000000sec<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; user &nbsp; &nbsp; system &nbsp; &nbsp; &nbsp;total &nbsp; &nbsp; &nbsp; &nbsp;real<br />
<span style="color: #000000; font-weight: bold;">for</span>: &nbsp; &nbsp; &nbsp;<span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.000388</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #7a0874; font-weight: bold;">times</span>: &nbsp; &nbsp;<span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.000339</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
upto: &nbsp; &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.000341</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
downto: &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.000339</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
=====================================================<br />
<br />
<span style="color: #007800;">n</span>=<span style="color: #000000;">10000</span><br />
Rehearsal <span style="color: #660033;">-------------------------------------------</span><br />
<span style="color: #000000; font-weight: bold;">for</span>: &nbsp; &nbsp; &nbsp;<span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.004486</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #7a0874; font-weight: bold;">times</span>: &nbsp; &nbsp;<span style="color: #000000;">0.010000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.010000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.003675</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
upto: &nbsp; &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.004407</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
downto: &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.004121</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #660033;">----------------------------------</span> total: 0.010000sec<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; user &nbsp; &nbsp; system &nbsp; &nbsp; &nbsp;total &nbsp; &nbsp; &nbsp; &nbsp;real<br />
<span style="color: #000000; font-weight: bold;">for</span>: &nbsp; &nbsp; &nbsp;<span style="color: #000000;">0.010000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.010000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.003961</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #7a0874; font-weight: bold;">times</span>: &nbsp; &nbsp;<span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.005113</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
upto: &nbsp; &nbsp; <span style="color: #000000;">0.010000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.010000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.003592</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
downto: &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.000000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.003592</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
=====================================================<br />
<br />
<span style="color: #007800;">n</span>=<span style="color: #000000;">100000</span><br />
Rehearsal <span style="color: #660033;">-------------------------------------------</span><br />
<span style="color: #000000; font-weight: bold;">for</span>: &nbsp; &nbsp; &nbsp;<span style="color: #000000;">0.040000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.040000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.042573</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #7a0874; font-weight: bold;">times</span>: &nbsp; &nbsp;<span style="color: #000000;">0.030000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.030000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.039094</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
upto: &nbsp; &nbsp; <span style="color: #000000;">0.030000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.030000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.041495</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
downto: &nbsp; <span style="color: #000000;">0.040000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.040000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.049316</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #660033;">----------------------------------</span> total: 0.140000sec<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; user &nbsp; &nbsp; system &nbsp; &nbsp; &nbsp;total &nbsp; &nbsp; &nbsp; &nbsp;real<br />
<span style="color: #000000; font-weight: bold;">for</span>: &nbsp; &nbsp; &nbsp;<span style="color: #000000;">0.040000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.040000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.040422</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #7a0874; font-weight: bold;">times</span>: &nbsp; &nbsp;<span style="color: #000000;">0.040000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.040000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.037030</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
upto: &nbsp; &nbsp; <span style="color: #000000;">0.040000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.040000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.041921</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
downto: &nbsp; <span style="color: #000000;">0.040000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.040000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.039868</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
=====================================================<br />
<br />
<span style="color: #007800;">n</span>=<span style="color: #000000;">1000000</span><br />
Rehearsal <span style="color: #660033;">-------------------------------------------</span><br />
<span style="color: #000000; font-weight: bold;">for</span>: &nbsp; &nbsp; &nbsp;<span style="color: #000000;">0.390000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.390000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.401887</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #7a0874; font-weight: bold;">times</span>: &nbsp; &nbsp;<span style="color: #000000;">0.370000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.370000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.376656</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
upto: &nbsp; &nbsp; <span style="color: #000000;">0.370000</span> &nbsp; <span style="color: #000000;">0.010000</span> &nbsp; <span style="color: #000000;">0.380000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.384750</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
downto: &nbsp; <span style="color: #000000;">0.370000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.370000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.380184</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #660033;">----------------------------------</span> total: 1.510000sec<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; user &nbsp; &nbsp; system &nbsp; &nbsp; &nbsp;total &nbsp; &nbsp; &nbsp; &nbsp;real<br />
<span style="color: #000000; font-weight: bold;">for</span>: &nbsp; &nbsp; &nbsp;<span style="color: #000000;">0.400000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.400000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.411929</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #7a0874; font-weight: bold;">times</span>: &nbsp; &nbsp;<span style="color: #000000;">0.370000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.370000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.386443</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
upto: &nbsp; &nbsp; <span style="color: #000000;">0.370000</span> &nbsp; <span style="color: #000000;">0.010000</span> &nbsp; <span style="color: #000000;">0.380000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.379820</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
downto: &nbsp; <span style="color: #000000;">0.370000</span> &nbsp; <span style="color: #000000;">0.000000</span> &nbsp; <span style="color: #000000;">0.370000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">0.379068</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
=====================================================<br />
<br />
<span style="color: #007800;">n</span>=<span style="color: #000000;">10000000</span><br />
Rehearsal <span style="color: #660033;">-------------------------------------------</span><br />
<span style="color: #000000; font-weight: bold;">for</span>: &nbsp; &nbsp; &nbsp;<span style="color: #000000;">3.920000</span> &nbsp; <span style="color: #000000;">0.020000</span> &nbsp; <span style="color: #000000;">3.940000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">4.021434</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #7a0874; font-weight: bold;">times</span>: &nbsp; &nbsp;<span style="color: #000000;">3.690000</span> &nbsp; <span style="color: #000000;">0.030000</span> &nbsp; <span style="color: #000000;">3.720000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">3.844118</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
upto: &nbsp; &nbsp; <span style="color: #000000;">3.710000</span> &nbsp; <span style="color: #000000;">0.030000</span> &nbsp; <span style="color: #000000;">3.740000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">3.844035</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
downto: &nbsp; <span style="color: #000000;">3.700000</span> &nbsp; <span style="color: #000000;">0.020000</span> &nbsp; <span style="color: #000000;">3.720000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">3.795330</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #660033;">---------------------------------</span> total: 15.120000sec<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; user &nbsp; &nbsp; system &nbsp; &nbsp; &nbsp;total &nbsp; &nbsp; &nbsp; &nbsp;real<br />
<span style="color: #000000; font-weight: bold;">for</span>: &nbsp; &nbsp; &nbsp;<span style="color: #000000;">3.910000</span> &nbsp; <span style="color: #000000;">0.020000</span> &nbsp; <span style="color: #000000;">3.930000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">4.003016</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #7a0874; font-weight: bold;">times</span>: &nbsp; &nbsp;<span style="color: #000000;">3.670000</span> &nbsp; <span style="color: #000000;">0.020000</span> &nbsp; <span style="color: #000000;">3.690000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">3.749495</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
upto: &nbsp; &nbsp; <span style="color: #000000;">3.700000</span> &nbsp; <span style="color: #000000;">0.020000</span> &nbsp; <span style="color: #000000;">3.720000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">3.919785</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
downto: &nbsp; <span style="color: #000000;">3.690000</span> &nbsp; <span style="color: #000000;">0.030000</span> &nbsp; <span style="color: #000000;">3.720000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> &nbsp;<span style="color: #000000;">3.789975</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
=====================================================<br />
<br />
<span style="color: #007800;">n</span>=<span style="color: #000000;">100000000</span><br />
Rehearsal <span style="color: #660033;">-------------------------------------------</span><br />
<span style="color: #000000; font-weight: bold;">for</span>: &nbsp; &nbsp; <span style="color: #000000;">39.260000</span> &nbsp; <span style="color: #000000;">0.240000</span> &nbsp;<span style="color: #000000;">39.500000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #000000;">40.293460</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #7a0874; font-weight: bold;">times</span>: &nbsp; <span style="color: #000000;">36.700000</span> &nbsp; <span style="color: #000000;">0.210000</span> &nbsp;<span style="color: #000000;">36.910000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #000000;">37.450910</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
upto: &nbsp; &nbsp;<span style="color: #000000;">37.020000</span> &nbsp; <span style="color: #000000;">0.260000</span> &nbsp;<span style="color: #000000;">37.280000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #000000;">38.963391</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
downto: &nbsp;<span style="color: #000000;">36.940000</span> &nbsp; <span style="color: #000000;">0.230000</span> &nbsp;<span style="color: #000000;">37.170000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #000000;">37.806189</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #660033;">--------------------------------</span> total: 150.860000sec<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; user &nbsp; &nbsp; system &nbsp; &nbsp; &nbsp;total &nbsp; &nbsp; &nbsp; &nbsp;real<br />
<span style="color: #000000; font-weight: bold;">for</span>: &nbsp; &nbsp; <span style="color: #000000;">39.230000</span> &nbsp; <span style="color: #000000;">0.240000</span> &nbsp;<span style="color: #000000;">39.470000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #000000;">40.471694</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #7a0874; font-weight: bold;">times</span>: &nbsp; <span style="color: #000000;">36.850000</span> &nbsp; <span style="color: #000000;">0.240000</span> &nbsp;<span style="color: #000000;">37.090000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #000000;">38.302817</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
upto: &nbsp; &nbsp;<span style="color: #000000;">36.870000</span> &nbsp; <span style="color: #000000;">0.230000</span> &nbsp;<span style="color: #000000;">37.100000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #000000;">37.802815</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
downto: &nbsp;<span style="color: #000000;">36.970000</span> &nbsp; <span style="color: #000000;">0.220000</span> &nbsp;<span style="color: #000000;">37.190000</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #000000;">38.052300</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
=====================================================</div></div>
<p>有趣的是ruby1.9的循环操作性能竟然普遍都是负增长，这倒为我们之后的list performance比较埋下了伏笔。</p>
<p>热身运动到此结束，似乎有喧宾夺主之嫌，所以赶紧搞个part 2…，下篇文章我们会用上面循环性能测试的疑似最佳表现者times来进行list append性能测试，敬请期待。</p>

	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://blog.samsonis.me/2010/02/list-performance-ruby-1-8-and-1-9-part-2/" title="List performance: ruby 1.8 and 1.9 (Part 2) (February 22, 2010)">List performance: ruby 1.8 and 1.9 (Part 2)</a> (17)</li>
	<li><a href="http://blog.samsonis.me/2011/02/rubygems-1-5-2-manual-upgrade/" title="RubyGems 1.5.2 Manual Upgrade (February 16, 2011)">RubyGems 1.5.2 Manual Upgrade</a> (0)</li>
	<li><a href="http://blog.samsonis.me/2010/02/rubys-python-simplehttpserver/" title="ruby&#8217;s &#8220;python -m SimpleHTTPServer&#8221; (February 21, 2010)">ruby&#8217;s &#8220;python -m SimpleHTTPServer&#8221;</a> (2)</li>
	<li><a href="http://blog.samsonis.me/2010/02/ruby-gem-geoip-and-rack-geoipcountry/" title="Ruby gem geoip and Rack::GeoIPCountry (February 25, 2010)">Ruby gem geoip and Rack::GeoIPCountry</a> (2)</li>
	<li><a href="http://blog.samsonis.me/2011/12/downgrade-rubygems/" title="Downgrade Rubygems (December 5, 2011)">Downgrade Rubygems</a> (0)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://blog.samsonis.me/2010/02/list-performance-ruby-1-8-and-1-9-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

