# Why is my program taking so long?

**URL:** <https://www.ruby-forum.com/t/why-is-my-program-taking-so-long/109098>\
**Category:** Ruby\
**Created:** [July 11, 2007, 3:22pm UTC](https://www.ruby-forum.com/t/why-is-my-program-taking-so-long/109098 "2007-07-11T15:22:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![finer\_recliner](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/f07891/32.png) [@finer\_recliner](https://www.ruby-forum.com/u/finer_recliner)\
**Post date:** [July 11, 2007, 3:22pm UTC](https://www.ruby-forum.com/t/why-is-my-program-taking-so-long/109098/1 "2007-07-11T15:22:46Z")

</div>

i just wrote a program in ruby that generates sudoku puzzles. its  
fairly long (~600 lines) so i wont post it all here.

from what i’ve read from other programmers (who may have coded their  
sudoku generators in C++ or java or something else) they’re programs  
are able to generate much faster than mine, claiming they can generate  
hundreds of puzzles per second. mine can generate ONE puzzle in ~700  
ms ☹

so my question is, how can i use the ruby debugger to find out where  
my application is spending most of its time, so i can try to optimize  
it some more.

thanks in advance for the help.

---

<div class="post-metadata">

**Author:** ![finer\_recliner](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/f07891/32.png) [@finer\_recliner](https://www.ruby-forum.com/u/finer_recliner)\
**Post date:** [July 11, 2007, 3:25pm UTC](https://www.ruby-forum.com/t/why-is-my-program-taking-so-long/109098/2 "2007-07-11T15:25:47Z")

</div>

On Jul 8, 2:42 pm, finer recliner [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> so my question is, how can i use the ruby debugger to find out where  
> my application is spending most of its time, so i can try to optimize  
> it some more.
> 
> thanks in advance for the help.

If you require the profiler library at the top of your code (or one of  
the faster, newer profiling libraries available) you can get a very  
nice listing of all method calls, call counts, and execution time for  
each.

A wee bit of Googling should give you all the details you need.

---

<div class="post-metadata">

**Author:** ![finer\_recliner](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/f07891/32.png) [@finer\_recliner](https://www.ruby-forum.com/u/finer_recliner)\
**Post date:** [July 11, 2007, 3:43pm UTC](https://www.ruby-forum.com/t/why-is-my-program-taking-so-long/109098/3 "2007-07-11T15:43:51Z")

</div>

If you want to try out something new in sudoku, try shendoku, using  
the sudoku rules but playing two people, one against the other, like  
battleshipps. They have a free version to download at

> **[ShEndoKu.com is for sale | HugeDomains](https://www.hugedomains.com/domain_profile.cfm?d=shendoku.com)**
>
> Extensive selection of high-quality domain names. Knowledgeable, friendly customer support.

. Anything else they are bringing out or they are working on you can  
find at [www.shendoku.com](http://www.shendoku.com) or at they´r blog [www.shendoku.blogspot.com](http://www.shendoku.blogspot.com) .  
Have fun, I am. I specially like one slogan I heard about Shendoku:  
SUDOKU is like masturbation (one person)… SHENDOKU is like sex (it  
takes two).

---

<div class="post-metadata">

**Author:** ![finer\_recliner](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/f07891/32.png) [@finer\_recliner](https://www.ruby-forum.com/u/finer_recliner)\
**Post date:** [July 12, 2007, 3:00am UTC](https://www.ruby-forum.com/t/why-is-my-program-taking-so-long/109098/4 "2007-07-12T03:00:06Z")

</div>

On Jul 11, 2007, at 09:17 , finer recliner wrote:

> so my question is, how can i use the ruby debugger to find out where my application is spending most of its time, so i can try to optimize it some more.

[http://ruby-prof.rubyforge.org/](http://ruby-prof.rubyforge.org/)
