sims/performance/performance.rake in rubyrep-1.1.2 vs sims/performance/performance.rake in rubyrep-1.2.0
- old
+ new
@@ -1,5 +1,6 @@
+
require 'rake'
require 'benchmark'
require File.dirname(__FILE__) + '/../sim_helper'
@@ -134,21 +135,21 @@
(1..BIG_REP_CHANGE_NUMBER).each do
# Updating progress bar
progress_bar.step
- database = [:left, :right].rand
+ database = [:left, :right][rand(2)]
case rand(100)
when 0...BIG_REP_INSERT
attributes = random_attributes
attributes['diff_type'] = 'insert'
attributes['id'] = next_id
all_ids[database] << next_id
next_id += 1
session.send(database).insert_record 'big_rep', attributes
when BIG_REP_INSERT...BIG_REP_UPDATE
- id = all_ids[database].rand
+ id = all_ids[database][rand(all_ids[database].size)]
attributes = session.send(database).select_one("select * from big_rep where id = '#{id}'")
column = number_columns[rand(number_columns.size)]
attributes[column] = rand(1000)
session.send(database).update_record 'big_rep', attributes
else
\ No newline at end of file