pat eyler
2/23/2006 10:48:00 PM
On 2/23/06, Meinrad Recheis <meinrad.recheis@gmail.com> wrote:
> On 2/23/06, Alexis Reigel <mail@koffeinfrei.org> wrote:
> >
> > Hi all
> >
> > I've ported the following c++ code to ruby. It is a recursive
> > (backtracking) sudoku-solving algorithm. Well, I was rather surprised by
> > the execution time I got:
> >
> > c++ code: 0.33 seconds
> > ruby code: 27.65 seconds
> >
> > [...]
> >
>
> ruby code may be up to 100 times slower than c++ binaries. i think it is
> normal.
> also i don't see any common performance crimes (such as using += with
> strings) in your code.
there are a couple of (really minor) things like using for loops instead
of uptos, but those won't buy the kind of time Alexis wants to see.
RubyInline might be just the ticket though. Run the code through
the profiler (a long process) and Inline the method that's making the
biggest hit.
> -- henon
>
>
--
thanks,
-pate
-------------------------