Alexis Reigel 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
> 
> The implementation should do the same, at least they run through the
> method/function "next_state"/"nextone" both 127989 times.
> 
> Now how can it be that the ruby code is so awfully slow?
> Is that normal for ruby?
> Or is my implementation so horribly bad?
> I am aware that the non-native and object-oriented ruby code won't be as
> fast as the c++ one, but I didn't expect such a gap.

Post the code somewhere, there might be room for improvement
in the algorithm though it will still be considerably slower.

> Thanks for comments.
> 
> Alexis.


E

-- 
Posted via http://www.ruby-forum.com/.