Topic: Why might rails 3 and better use of lazy loading reduce performance?

I've just spent a good chunk of time upgrading a rails app to rails3. Part of the inspiration here was just to be part of the new rails coolness, but I thought that taking advantage of some of the super slick new rails arel interfacing (together with meta_where) would also help with some performance issues that we were having on the application.

First, the switch over to rails3 seems to have increased both the benchmark and profile times. I read somewhere that this might be connected to slower active record performance when using the old API style. Also, I had to reconfigure some helpers to not use concat (as it was double printing things and making all kinds of messes) and the profiling I've done seems to indicate that content_tags are eating up a bunch of time in some iterations I have displaying comments and tables_of_contents (though admittedly, I'm pretty new to ruby-prof profile interpretation and could be misreading things).

However, now that I've switched over to using where calls (etc) and chaining joins and such in much more clever ways, I'm seeing yet another performance hit! This doesn't make any sense to me. Without posting too much code, can anyone tell me why I might be seeing this? I have a feeling that a lot of my issues boil down to the use of acts_as_tree, and I may be able to improve things by switching to acts_as_tree_with_dotted_ids to clear up this side of the problem, but still - it seems that I shouldn't be seeing what I'm seeing here.

These are benchmark times for one of my tests

rails2              rails3              rails3+lazy_loading
1162 ms             2.49 sec            3.06 sec

As I said, I don't want to post a bunch of code right away - just first to get a sense of what things I should check and what further information might be helpful in diagnosing what is going on.

Cheers

Chris