George D. wrote in post #1062009:
I will also look into this google_hash gem, it should also be useful.
Hi,
I think in Ruby speed is not the primary objective. So if you need the
code to run faster (by about the same order of magnitude), probably you
can transform the critical part into C.
Regards,
Bill
Hi George,
On Thu, May 24, 2012 at 7:34 PM, George D. [email protected]
wrote:
Thank you once again for your help.
I advanced the implementation a bit
- now it doesn’t choke as easily because of the single large String
- there are #clear and #empty? methods
- resetting is more efficient
- there is Enumerable functionality
Have fun!
Kind regards
robert
Hi,
Sorry, I should have given more details. While I am doing this is an
academic setting, it isn’t homework in the traditional sense. This is
part of my “personal initiative project”, reaching outside of my field
of studies (math and physics) but with outside help allowed. It revolves
around a Korean 4x4 board game, which I am currently trying to solve
through brute force, hence the ridiculous requirements. Each possible
position of the board is matched to an integer. An error of zero is
imperative, but using 512 MB of RAM isn’t an issue at all: I only need
to run that calculation once, in a reasonable time. I will also look
into this google_hash gem, it should also be useful.
Thank you once again for your help.
Best regards,
George
I advanced the implementation a bit
Thank you very much, this is incredibly useful!
I think in Ruby speed is not the primary objective. So if you need the
code to run faster (by about the same order of magnitude), probably you
can transform the critical part into C.
I don’t know much C at all, but I did use RubyInline for a few critical,
but very simple methods. With that and Robert K.'s BitSet, the
program is efficient enough, now I just have to let it run for a while.
Thank you once again for your help!
On Thu, May 24, 2012 at 1:22 PM, Admin T. [email protected]
wrote:
+1
The Pickaxe has a good section about this (it’s actually about how to
integrate with a C library, but if you know C and know how to make Ruby
talk to C, then you should be able to get it).