What is considered a large Ruby Project?

In terms of LoC. I realize this isn’t the greatest metric, but in this case it’s relevant. I’ve joined a project that claims 20k LoC and the project is just too slow in dev mode (the LoC is given as the reason for the slowness).

I’m still fairly new to Rails in general, is this considered small, medium, large? I expressed surprise when they claimed 20k as being large, to me, that’s tiny, so I’d like to get more input.

Well ruby is quite expressive, so you do get quite a long way with a
few thousand LoCs. That said, a project I consider large and that had
matured over nearly 5 years had (tests + code) not far off 100000 LoC
(as measured by rake stats). The ruby 1.9 searches its load path for
what it has already loaded is v. slow though, so number of files,
dependencies on gems etc. can be more relevant that actual amount of
code.

Fred

That's large. On a full NFL and NCAA statistics based site with over 30
controllers, 60 models, and full test code, each of my sites has approx.
12k to 13k lines of code.

LoC is not the reason for slowness. If the code is optimized, DRY, and
programmed correctly, it won't matter how many LoC you have in your
project.

Development mode usually has several things that slow things down,
namely lack of caching. Also, if your databases are not properly
normalized or overly normalized, and not indexed properly, you could
create a lot of slowness.

What is slow about your project? What OS are you using? Are you
running virtual? Do you have enough resources to support your
environments? What server env. are you running?

Also, you could just run a rake stats to see how much LoC the project
truly has.

My apologies, I should have specified.

What's happened is that the reloading is extremely slow. If you turn
cache_classes off, simply hitting refresh on a page will take 30+ seconds,
whereas with cache_classes, the performance is reasonable.

The result is that the team has turned cache_classes off in the dev
environment, so any changes require stopping/starting the server, and then
waiting 30+ seconds for it to come back up. This slowness affects the
generate functionality, cucumber tests, rspec tests, so on and so forth.
It's also killing productivity in a *severe* way, the debug/test feedback
loop is atrocious imo.

The explanation I've been given is that the project has roughly 20k LoC, and
the loading is just too slow.

I'm still fairly new to the Rails ecosystem, so I'm currently trying to
gather information, and I plan on eventually trying to profile the startup
times to see if I can lessen this issue. Any advice, especially on the
profiling, would be greatly appreciated.

The project itself is running Rails 3 on Ruby 1.8.7 (we use RVM), and I've
been told they "got the number of gems down to 130", so I'm sure that's an
issue as well.

I'll run rake stats when I'm able to as well, I'll let you know what it
reports.

My apologies, I should have specified.

What's happened is that the reloading is extremely slow. If you turn
cache_classes off, simply hitting refresh on a page will take 30+ seconds,
whereas with cache_classes, the performance is reasonable.

The result is that the team has turned cache_classes off in the dev
environment, so any changes require stopping/starting the server, and then
waiting 30+ seconds for it to come back up. This slowness affects the
generate functionality, cucumber tests, rspec tests, so on and so forth.
It's also killing productivity in a *severe* way, the debug/test feedback
loop is atrocious imo.

Not an answer to the problem, but you might want to look at spork for
your tests.

The explanation I've been given is that the project has roughly 20k LoC, and
the loading is just too slow.

I'm still fairly new to the Rails ecosystem, so I'm currently trying to
gather information, and I plan on eventually trying to profile the startup
times to see if I can lessen this issue. Any advice, especially on the
profiling, would be greatly appreciated.

ruby-prof is pretty good. If you suspect that the issue is loading
stuff, then you could monkey patch require to log what it's requiring
and how long it took, pick the file(s) with big loading times and have
a look

Fred

I would test request loading through notifications:

http://railscasts.com/episodes/249-notifications-in-rails-3

I would follow Fred's suggestion on profiling with ruby-prof which you
can find here: http://rubyforge.org/projects/ruby-prof . Or, if you
want to go with another solid profiler go with (newrelic):
http://newrelic.com.