Why is my program taking so long?

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 :frowning:

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.

On Jul 8, 2:42 pm, finer recliner [email protected] 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.

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

. Anything else they are bringing out or they are working on you can
find at www.shendoku.com or at they´r blog 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).

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/