From: Andreas S Date: 2009-04-23T07:42:10+09:00 Subject: ruby1.9 and ActiveRecord --_abdedce4-be36-40ac-9b05-7afdaebdd506_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I wanted to switch my app from ruby 1.8 to 1.9 but I notice ar-extensions' = ActiveRecord#import takes longer. The code to demonstrate it is attached. T= here is no significant time difference in both variations in ruby 1.8 (I us= ed fastercsv for 1.8). It looks like 1.9 issue=2C but first of all I'd appr= eciate if somebody can confirm this behavior Thanks in advance. -andre ------ test_ar.rb ----- require 'ar-extensions' require 'csv' ActiveRecord::Base.establish_connection :adapter =3D> 'sqlite3'=2C :dbfile = =3D> ':memory:' ActiveRecord::Schema.define do create_table 'jobs' do |t| t.column :xid=2C :integer t.column :user=2C :string t.column :time=2C :time t.column :duration=2C :integer t.column :machine=2C :string t.column :command=2C :string end end # This one is slow. Notice local variable "job" job =3D Class.new ActiveRecord::Base do set_table_name 'jobs' end # This one is fast. Notice constant "Job" #Job =3D Class.new ActiveRecord::Base do # set_table_name 'jobs' #end #job =3D Job data =3D CSV.read "data.csv"=2C :headers =3D> false job.import %w{ xid user time duration machine command }=2C data=2C :valida= te =3D> false # Fast one (with constant Job) [lwe1:fx] time ruby19 test_ar.rb -- create_table("jobs") -> 0.0701s 6.349u 0.231s 0:06.97 94.2% 0+0k 0+0io 0pf+0w # Slow one (with local variable job) [lwe1:fx] time ruby19 test_ar.rb -- create_table("jobs") -> 0.0647s 27.533u 0.270s 0:28.08 99.0% 0+0k 0+0io 0pf+0w _________________________________________________________________ Rediscover Hotmail=AE: Now available on your iPhone or BlackBerry http://windowslive.com/RediscoverHotmail?ocid=3DTXT_TAGLM_WL_HM_Rediscover_= Mobile2_042009= --_abdedce4-be36-40ac-9b05-7afdaebdd506_--