# Code reloading by timer (in development env)

**URL:** <https://www.ruby-forum.com/t/code-reloading-by-timer-in-development-env/172510>\
**Category:** Rails\
**Created:** [July 22, 2009, 4:41pm UTC](https://www.ruby-forum.com/t/code-reloading-by-timer-in-development-env/172510 "2009-07-22T16:41:01Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![axyd80](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/82dd89/32.png) [@axyd80](https://www.ruby-forum.com/u/axyd80)\
**Post date:** [July 22, 2009, 4:41pm UTC](https://www.ruby-forum.com/t/code-reloading-by-timer-in-development-env/172510/1 "2009-07-22T16:41:01Z")

</div>

Hello, i’m working on huge rails project and it’s terribly slow in  
development mode.

There are lots of code and lots of AJAX requests, so it’s very slow as  
(i guess) it reloads all the code several times per one page.

I’m wondering, maybe there is a way to speed it up? Maybe it’s possible  
to reload it for example every 15 seconds? Or even better - every 15  
seconds check for changed files and reload only if there is changes.

What do you think?

---

<div class="post-metadata">

**Author:** ![axyd80](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/82dd89/32.png) [@axyd80](https://www.ruby-forum.com/u/axyd80)\
**Post date:** [July 22, 2009, 5:06pm UTC](https://www.ruby-forum.com/t/code-reloading-by-timer-in-development-env/172510/2 "2009-07-22T17:06:25Z")

</div>

Silly question: Are you using Webrick or Mongrel?

When I prepped up a little rails dev app in Webrick, it was so slow I  
wanted to chuck it. Then I put in Mongrel and it speed things up by  
literally a 100+ percent.

On Wed, Jul 22, 2009 at 10:41 AM, Alexey  
Petrushin[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> ## What do you think?
> 
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
> 
> >

–  
Rilindo F.  
AOL Instant Messenger: rilindo  
Google Talk: removed\_email\_address@domain.invalid  
Web S.: [http://www.monzell.com](http://www.monzell.com)  
Primary: removed\_email\_address@domain.invalid  
Secondary: removed\_email\_address@domain.invalid  
"Rich bachelors should be heavily taxed. It is not fair that some men  
should be happier than others. – Oscar Wilde

---

<div class="post-metadata">

**Author:** ![axyd80](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/82dd89/32.png) [@axyd80](https://www.ruby-forum.com/u/axyd80)\
**Post date:** [July 22, 2009, 7:02pm UTC](https://www.ruby-forum.com/t/code-reloading-by-timer-in-development-env/172510/3 "2009-07-22T19:02:55Z")

</div>

i think Foster is right. webrick is bit slower. if you use Mongrel  
then its become  
more faster. you can make mongrel cluster to make it more faster. in  
spite of making  
the cluster if you think your app is still slow then you can use  
performance  
analysis tool like new relic. it will help you to see which part of  
your coding  
is taking the most of the time.

in my case i have found that eager loading makes the code bit faster  
as  
it always reduce the query moreover you can cache the static content  
of you site even you can partially cache the content of page.

these small things will help you to make your site faster

---

<div class="post-metadata">

**Author:** ![axyd80](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/82dd89/32.png) [@axyd80](https://www.ruby-forum.com/u/axyd80)\
**Post date:** [July 22, 2009, 9:38pm UTC](https://www.ruby-forum.com/t/code-reloading-by-timer-in-development-env/172510/4 "2009-07-22T21:38:31Z")

</div>

> Silly question: Are you using Webrick or Mongrel?  
> No, I’m using Mongrel.

> these small things will help you to make your site faster  
> I’m talking about the development environment, in the production (in  
> cluster) it works fast :).

The problem is here (config/development.rb):

> config.cache\_classes = false  
> if i change it to  
> config.cache\_classes = true  
> it works really fast.

So i hoped maybe there is a way to reload it more rarely.

---

<div class="post-metadata">

**Author:** ![axyd80](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/82dd89/32.png) [@axyd80](https://www.ruby-forum.com/u/axyd80)\
**Post date:** [July 22, 2009, 9:52pm UTC](https://www.ruby-forum.com/t/code-reloading-by-timer-in-development-env/172510/5 "2009-07-22T21:52:30Z")

</div>

Okay, now that makes sense. 🙂

Now that said, my understanding is that turning cache off in  
development is a bad thing, because that meant that new code will not  
be executed automatically until you restart the server. I could be  
wrong, though. . .

On Wed, Jul 22, 2009 at 3:38 PM, Alexey  
Petrushin[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> if i change it to
> 
> > config.cache\_classes = true  
> > it works really fast.
> 
> ## So i hoped maybe there is a way to reload it more rarely.
> 
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
> 
> >

–  
Rilindo F.  
AOL Instant Messenger: rilindo  
Google Talk: removed\_email\_address@domain.invalid  
Web S.: [http://www.monzell.com](http://www.monzell.com)  
Primary: removed\_email\_address@domain.invalid  
Secondary: removed\_email\_address@domain.invalid  
"Rich bachelors should be heavily taxed. It is not fair that some men  
should be happier than others. – Oscar Wilde

---

<div class="post-metadata">

**Author:** ![axyd80](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/82dd89/32.png) [@axyd80](https://www.ruby-forum.com/u/axyd80)\
**Post date:** [July 23, 2009, 10:08am UTC](https://www.ruby-forum.com/t/code-reloading-by-timer-in-development-env/172510/6 "2009-07-23T10:08:50Z")

</div>

The solution 🙂

> **[GitHub - thedarkone/rails-dev-boost: Speed up slow Rails development mode](https://github.com/thedarkone/rails-dev-boost/tree/master)**
>
> master

---

<div class="post-metadata">

**Author:** ![axyd80](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/82dd89/32.png) [@axyd80](https://www.ruby-forum.com/u/axyd80)\
**Post date:** [July 22, 2009, 10:39pm UTC](https://www.ruby-forum.com/t/code-reloading-by-timer-in-development-env/172510/7 "2009-07-22T22:39:52Z")

</div>

On Jul 22, 8:38 pm, Alexey P. \<rails-mailing-l…@andreas-  
[s.net](http://s.net)\> wrote:

> The problem is here (config/development.rb):\> config.cache\_classes = false  
> if i change it to
> 
> > config.cache\_classes = true
> 
> it works really fast.
> 
> So i hoped maybe there is a way to reload it more rarely.

There’s nothing builtin - doesn’t mean there’s not a way for you to  
change it though! I’d start by looking at how the existing code  
reloading stuff works.

Fred
