0
@@ -41,19 +41,19 @@ def bench1(ntimes, conn, sql)
0
'list=[]; rs.each{|row| }',
0
'list=[]; rs.each{|row| list << row}',
0
'list=[]; rs.each{|row| list<<Stock1.new(*row)}',
0
- #'list=[]; record.each {|row| list << Stock1.new(row) }',
0
- #'list=[]; for row in rs do list << Stock1.new(*row) end',
0
- #'list=rs.collect {|row| StockInfo.new(*row) }',
0
+ #'list=[]; record.each {|row| arr << Stock1.new(row) }',
0
+ #'list=[]; for row in rs do arr << Stock1.new(*row) end',
0
+ #'arr=rs.collect {|row| StockInfo.new(*row) }',
0
'list=[]; rs.each_hash{|hash| list << hash}',
0
'list=[]; rs.each_hash{|h| list<<Stock2.new(h)}',
0
- 'list = rs.fetch_all_hash()',
0
- 'list = rs.fetch_all_array()',
0
- 'list = rs.fetch_all_object(Stock0)',
0
- 'list=[]; rs.fetch_all_hash{|hash| list << hash}',
0
- 'list=[]; rs.fetch_all_array{|arr| list << arr}',
0
- 'list=[]; rs.fetch_all_object(Stock0){|o|list<<o}',
0
- 'list=[]; rs.fetch_all_hash{|h|list<<Stock2.new(h)}',
0
- 'list=[]; rs.fetch_all_array{|a|list<<Stock1.new(*a)}',
0
+ 'list = rs.fetch_all_as_hashes()',
0
+ 'list = rs.fetch_all_as_arrays()',
0
+ 'list = rs.fetch_all_as(Stock0)',
0
+ 'list=[]; rs.fetch_all_as_hashes{|h| list << h}',
0
+ 'list=[]; rs.fetch_all_as_arrays{|a| list << a}',
0
+ 'list=[]; rs.fetch_all_as(Stock0){|o| list << o}',
0
+ 'list=[]; rs.fetch_all_as_hashes{|h| list<<Stock2.new(h) }',
0
+ 'list=[]; rs.fetch_all_as_arrays{|a| list<<Stock1.new(*a)}',
0
puts "*** ntimes=#{ntimes}"
0
@@ -63,8 +63,7 @@ def bench1(ntimes, conn, sql)
0
job.report('#{code}') do
0
- result = conn.query(sql)
0
+ rs = conn.query(sql) # Mysql::Result
0
@@ -82,14 +81,14 @@ def bench2(ntimes, conn, sql)
0
'lst=[]; st.each{|row| lst<<row}',
0
'lst=[]; st.fetch{|row| lst<<row}',
0
'lst=[]; st.each{|row| lst<<Stock1.new(row)}',
0
- 'lst = st.fetch_all_hash',
0
- 'lst = st.fetch_all_array',
0
- 'lst = st.fetch_all_object(Stock0)',
0
- 'lst=[]; st.fetch_all_hash{|hash| lst<<hash}',
0
- 'lst=[]; st.fetch_all_array{|arr| lst<<arr}',
0
- 'lst=[]; st.fetch_all_object(Stock0){|o|lst<<o}',
0
- 'lst=[]; st.fetch_all_hash{|h|lst<<Stock1.new(h)}',
0
- 'lst=[]; st.fetch_all_array{|a|lst<<Stock1.new(*a)}',
0
+ 'lst = st.fetch_all_as_hashes',
0
+ 'lst = st.fetch_all_as_arrays',
0
+ 'lst = st.fetch_all_as(Stock0)',
0
+ 'lst=[]; st.fetch_all_as_hashes{|h| lst<<h}',
0
+ 'lst=[]; st.fetch_all_as_arrays{|a| lst<<a}',
0
+ 'lst=[]; st.fetch_all_as(Stock0){|o|lst<<o}',
0
+ 'lst=[]; st.fetch_all_as_hashes{|h| lst<<Stock1.new(h)}',
0
+ 'lst=[]; st.fetch_all_as_arrays{|a| lst<<Stock1.new(*a)}',
0
puts "*** ntimes=#{ntimes}"
0
@@ -195,9 +194,9 @@ def bench3(ntimes, conn, sql)
0
# stocks << StockInfo.new(hash)
0
- #list = result.fetch_all_hash() # 10.6
0
- #list = result.fetch_all_array() # 9.2
0
- list = result.fetch_all_object(Stock0) # 10.5
0
+ #list = result.fetch_all_as_hashes() # 10.6
0
+ #list = result.fetch_all_as_arrays() # 9.2
0
+ list = result.fetch_all_as(Stock0) # 10.5
0
#list.each do |e| p e end
Comments
No one has commented yet.