Slow performance in ruby 1.9.1

I’m not sure what ActiveRecord support status is for ruby 1.9.1, so I
apologize if this report is premature. By the way, I’m only using
ActiveRecord here, not Rails.

I notice a 4x slow down in my program when I switch to 1.9.1. I’ve
narrowed it down to this

works fine

class fast < ActiveRecord::Base
end

4x slower (I need to do this in my program because I’m building

table from the arbitrary csv input)
slow = Class.new ActiveRecord::Base

The slow.connection.execute and a few other methods are 10x slower in
ruby 1.9.1 but are fine in ruby 1.8.7. Benchmarking method call from
these 2 different ways of defining a class doesn’t reveal anything
(speed is ,practically speaking, the same). Any body ran into this
problem?

Thank you in advance.

I’m using:
activerecord 2.2.2
activesuport 2.2.2
ar-extensions 0.8.0
sqlite3-ruby 1.2.4
on RedHat Linux 2.6.9

A sample code to demonstrate it is as follow:

require ‘ar-extensions’
require ‘fastercsv’

ActiveRecord::Base.establish_connection :database =>
‘:memory:’, :adapter => ‘sqlite3’
ActiveRecord::Schema.define do
create_table ‘bubububu’ do |t|
t.string :user, :machine, :command
t.integer :duration, :pid
t.datetime :time
end
end

data = FasterCSV.read ARGV[0]

This is fine in ruby 1.8.7 and 1.9.1

#class Egg < ActiveRecord::Base

set_table_name “bubububu”

#end
#Egg.import [:pid, :user, :time, :duration, :machine, :command],
data, :validate => false

This ‘import’ is fine in ruby 1.8.7 but 4x slow in 1.9.1

egg = Class.new ActiveRecord::Base do
set_table_name “bubububu”
end
egg.import [:pid, :user, :time, :duration, :machine, :command],
data, :validate => false