Closed jaylevitt closed 13 years ago
Can you run p $:
in your rails c to see what load paths bundler is using? That will at least give an idea of where the problem might be. Also, does irb -r date
load home_run (you can see the output of p Date.today
to check)? If irb -r date
loads home_run, but rails c
does not, the problem is obviously in rails/bundler and not in home_run.
And confirmation that it's not getting loaded:
$ rails c profile
ruby-1.9.2-p290 :001 > Date.method(:s3e).source_location
=> ["/Users/jay/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/date/format.rb", 148]
$ home_run rails c profile
ruby-1.9.2-p290 :001 > Date.method(:s3e).source_location
=> ["/Users/jay/.rvm/gems/ruby-1.9.2-p290/gems/home_run-1.0.4/lib/date/format.rb", 148]
Actually, you see the site_ruby part? It is loading home_run. Why it's slower I'm not sure. Did you run those benchmarks multiple times each way? Try doing a Date::Format::STYLE
in both cases to see if home_run is loaded (if not, it will raise a NameError).
jaylevitt, any feedback on this? Are things working now?
Content preview: No, something got even weirder.. you're right, it was getting loaded whether I used the home_run launcher or not, and the variation in run times was due to randomness. But - User.all.first wasn't any faster than without home_run at all, and it has ten timestamp columns! So something's wrong. (Yet benchmarking Date.parse proves that it is in fact far faster with home_run loaded.) [...]
Content analysis details: (-1.9 points, 5.0 required)
pts rule name description
-0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000]
No, something got even weirder.. you're right, it was getting loaded whether I used the home_run launcher or not, and the variation in run times was due to randomness. But - User.all.first wasn't any faster than without home_run at all, and it has ten timestamp columns! So something's wrong. (Yet benchmarking Date.parse proves that it is in fact far faster with home_run loaded.)
I'm hoping to dig into it later today.
Ah. The lack of a performance difference in User.all.first is probably because you weren't attempting to access the column values, the database adapter you are using returns the date/timestamp column values as strings, and ActiveRecord does type conversion lazily. If you do User.all.each{|c| c.attributes}
, I think that will show a significant difference. Anyway, I'm closing this as it doesn't appear to be an issue with home_run.
I installed it:
And I added it to the Gemfile:
But I only get the speed boost when I launch rails console via home_run: