[Rails-core] don't reload in dev mode

2010-07-03 Thread rogerdpack
Request (unless rails already does this...) Currently with active_support it reloads the class chain at the beginning of each incoming HTTP request. Suggestion: reload the class chain only if a file in a lib path *has changed* Thoughts? -r -- You received this message because you are subscribed

Re: [Rails-core] don't reload in dev mode

2010-07-03 Thread Yehuda Katz
The only way to do this in a pure Ruby way is to poll all the files in a thread. I'm not sure if this would be more or less performant. We tried this in Merb and people were annoyed by the constant CPU usage (3-10%) used by polling the entire tree. Something like watchr could make this better. If

Re: [Rails-core] don't reload in dev mode

2010-07-03 Thread Nicolás Sanguinetti
On Sat, Jul 3, 2010 at 5:04 PM, Yehuda Katz wrote: > The only way to do this in a pure Ruby way is to poll all the files in a > thread. I'm not sure if this would be more or less performant. We tried this > in Merb and people were annoyed by the constant CPU usage (3-10%) used by > polling the ent

Re: [Rails-core] don't reload in dev mode

2010-07-03 Thread Konstantin Haase
I'm currently working on making the reload logic pluggable. Konstantin On Jul 3, 2010, at 22:04 , Yehuda Katz wrote: > The only way to do this in a pure Ruby way is to poll all the files in a > thread. I'm not sure if this would be more or less performant. We tried this > in Merb and people we

Re: [Rails-core] don't reload in dev mode

2010-07-04 Thread Konstantin Haase
On Jul 3, 2010, at 22:04 , Yehuda Katz wrote: > The only way to do this in a pure Ruby way is to poll all the files in a > thread. I'm not sure if this would be more or less performant. We tried this > in Merb and people were annoyed by the constant CPU usage (3-10%) used by > polling the enti

Re: [Rails-core] don't reload in dev mode

2010-07-04 Thread Xavier Noria
Wouldn't that be tricky, even impossible to do right unless you restrict the current use cases? Say you have A < B. First request evaluates A and B. Then you modify B, so you reload B in a second request. If you do not reload A, its superclass points to an obsolete object. And that's only an ex

Re: [Rails-core] don't reload in dev mode

2010-07-04 Thread Michael Koziarski
> Wouldn't that be tricky, even impossible to do right unless you > restrict the current use cases? > > Say you have A < B. First request evaluates A and B. > > Then you modify B, so you reload B in a second request. > > If you do not reload A, its superclass points to an obsolete object. In fact

Re: [Rails-core] don't reload in dev mode

2010-07-10 Thread Xavier Noria
Thinking about your approach. Let me ask you a quick question (written from my iPhone). We have class C @x = X end First request autoloads X because of an occurrence in a file that is not c.rb, then it autoloads C because the request needs it somewhere else. The AS cache at some poin

Re: [Rails-core] don't reload in dev mode

2010-07-10 Thread Konstantin Haase
On Jul 10, 2010, at 22:19 , Xavier Noria wrote: > class C > @x = X > end > > First request autoloads X because of an occurrence in a file that is > not c.rb, then it autoloads C because the request needs it somewhere > else. > > The AS cache at some point associates the string "X" to th

Re: [Rails-core] don't reload in dev mode

2010-07-10 Thread Xavier Noria
On Sun, Jul 11, 2010 at 12:45 AM, Konstantin Haase wrote: > On Jul 10, 2010, at 22:19 , Xavier Noria wrote: > >>   class C >>     @x = X >>   end >> >> First request autoloads X because of an occurrence in a file that is >> not c.rb, then it autoloads C because the request needs it somewhere >> e

Re: [Rails-core] don't reload in dev mode

2010-07-11 Thread Konstantin Haase
On Jul 11, 2010, at 01:28 , Xavier Noria wrote: > On Sun, Jul 11, 2010 at 12:45 AM, Konstantin Haase wrote: > >> On Jul 10, 2010, at 22:19 , Xavier Noria wrote: >> >>> class C >>> @x = X >>> end >>> >>> First request autoloads X because of an occurrence in a file that is >>> not c.rb,

Re: [Rails-core] don't reload in dev mode

2010-07-11 Thread Xavier Noria
On Sun, Jul 11, 2010 at 10:23 AM, Konstantin Haase wrote: >> No, everything would be wiped unconditionally. And so everything is >> afresh later. > > Only if everything is unloadable. As soon as require is used somewhere or > external code, this no longer is the case. > Sure, this might increase

Re: [Rails-core] don't reload in dev mode

2010-08-30 Thread Konstantin Haase
On Jul 11, 2010, at 11:49 , Xavier Noria wrote: > I am personally fine with the current approach, it is simple and has > not major drawbacks for me[*]. Only autoloads what is used etc. But if > someone finds a better way to manage this it would be awesome! Here's a write up of what I did in my fo