On E, 2008-10-13 at 02:19 +0200, Mislav Marohnić wrote:
> I've been profiling performance of our app and noticed that all the
> calls to Rails.env.production? (used extensively) are taking rather
> long.
> 
> 
> After seeing its source, everything was clear:
> http://github.com/rails/rails/tree/2bf58aa782d3b493f2d98f153324b93c5b058ba6/railties/lib/initializer.rb#L51-54
> 
> 
> First it does a `require`, then it instantiates a new object on each
> call. After removing the require and memoizing the object, I've upped
> the performance of our application by 5 req/s.
> 
> 
> Is there a reason for the current implementation?

The reason was to make Rails.env callable from inside the initializer
block (problem cause by the fact that AS is not loaded by railties
but is actually loaded later by AR).

Any ideas on how to make that work?


-- 
Tarmo Tänav <[EMAIL PROTECTED]>


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to