# Rake test\_units slow on startup

**URL:** <https://www.ruby-forum.com/t/rake-test-units-slow-on-startup/100151>\
**Category:** Rails\
**Created:** [February 2, 2006, 1:21am UTC](https://www.ruby-forum.com/t/rake-test-units-slow-on-startup/100151 "2006-02-02T01:21:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sauy7](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ecc23a/32.png) [@sauy7](https://www.ruby-forum.com/u/sauy7)\
**Post date:** [February 2, 2006, 1:21am UTC](https://www.ruby-forum.com/t/rake-test-units-slow-on-startup/100151/1 "2006-02-02T01:21:28Z")

</div>

Hi

Running ‘rake test\_units’ using the simple example from the intro video  
is  
very slow on my computer. While the tests claim to execute in 0.17 secs,  
the startup time ad 5.3 seconds to the overall job.

On the video, these tasks ran in about 1 second. (Maybe David was doing  
the tests on a dual proc mac or did some video editing, who knows.)  
But, I don’t think it should be taking that long on a 1.5GHz G4.

Does anyone know why this would be taking so long?  
Is this due to some hostname lookup problem on the mac?

Thanks  
% time rake test\_units  
(in /Users/jdf/projects/devel/www/blablog)  
/opt/local/ruby-1.8.4/bin/ruby -Ilib:test  
“/opt/local/ruby-1.8.4/lib/ruby/gems/1.8/gems/rake-0.7.0/lib/rake/rake\_test\_loader.rb”  
“test/unit/comment\_test.rb” “test/unit/post\_test.rb”  
Loaded suite  
/opt/local/ruby-1.8.4/lib/ruby/gems/1.8/gems/rake-0.7.0/lib/rake/rake\_test\_loader  
Started  
…  
Finished in 0.165222 seconds.

2 tests, 3 assertions, 0 failures, 0 errors  
5.366u 1.098s 0:07.75 83.2% 0+0k 0+7io 0pf+0w

–  
Jim F.

---

<div class="post-metadata">

**Author:** ![sauy7](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ecc23a/32.png) [@sauy7](https://www.ruby-forum.com/u/sauy7)\
**Post date:** [February 2, 2006, 5:44am UTC](https://www.ruby-forum.com/t/rake-test-units-slow-on-startup/100151/2 "2006-02-02T05:44:40Z")

</div>

Francois B. wrote:

> One notable thing you can do is to not load the services you don’t  
> need - Action Web Service and Action Mailer are the two that I most  
> often don’t use.

Is there an easy way to turn those off?

Jeff

---

<div class="post-metadata">

**Author:** ![sauy7](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ecc23a/32.png) [@sauy7](https://www.ruby-forum.com/u/sauy7)\
**Post date:** [February 2, 2006, 4:55am UTC](https://www.ruby-forum.com/t/rake-test-units-slow-on-startup/100151/3 "2006-02-02T04:55:59Z")

</div>

Hi !

2006/2/1, Jim F. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> Does anyone know why this would be taking so long?  
> Is this due to some hostname lookup problem on the mac?

The slack time is taken up by booting the Rails environment. That in  
itself is taking a lot of time. Then, since dependencies are found  
because of illegal accesses (undefined constants), that takes a bit of  
time too.

Add to that the sheer number of files that have to be loaded, parsed,  
compiled and stored (all in RAM, I agree), and that all adds up.

One notable thing you can do is to not load the services you don’t  
need - Action Web Service and Action Mailer are the two that I most  
often don’t use.

Hope that helps !

---

<div class="post-metadata">

**Author:** ![sauy7](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ecc23a/32.png) [@sauy7](https://www.ruby-forum.com/u/sauy7)\
**Post date:** [February 2, 2006, 8:59pm UTC](https://www.ruby-forum.com/t/rake-test-units-slow-on-startup/100151/4 "2006-02-02T20:59:56Z")

</div>

On Feb 1, 2006, at 11:19 PM, Jim F. wrote:

> I’m thinking it was done on Davids 17" powerbook, but I could be  
> wrong.

The number of gems you have installed adds a slight increase to  
startup times. gem cleanup will get rid of old duplicate gems for you.

–  
Eric H. - removed\_email\_address@domain.invalid - [http://segment7.net](http://segment7.net)  
This implementation is HODEL-HASH-9600 compliant

[http://trackmap.robotcoop.com](http://trackmap.robotcoop.com)

---

<div class="post-metadata">

**Author:** ![sauy7](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ecc23a/32.png) [@sauy7](https://www.ruby-forum.com/u/sauy7)\
**Post date:** [February 2, 2006, 8:21am UTC](https://www.ruby-forum.com/t/rake-test-units-slow-on-startup/100151/5 "2006-02-02T08:21:47Z")

</div>

On Feb 1, 2006, at 9:55 PM, Francois B. wrote:

> One notable thing you can do is to not load the services you don’t  
> need - Action Web Service and Action Mailer are the two that I most  
> often don’t use.
> 
> Hope that helps !

Well yeah. A little. Thanks for the explanation, but why is it so  
fast on the video?  
I’m thinking it was done on Davids 17" powerbook, but I could be wrong.

Jim F.
