I've done it before*, I just need to get my head round the problem - and what I'm trying to do.It would be about 30-40 lines of C# (my current native tongue!) for the basic multi-threading stuff.
I'm sure Ruby can do it in less.
Just spent a few hours trying to implement a threadpool, and for whatever reason it's ended up slower. Stupid Ruby.Personally I would use a thread pool. I'm sure Ruby has one. It saves a lot of boilerplate-code/hassle WRT to spawning and lifecycle of the threads.
Indeed sir. Just installed 1.9 and it works better in parallel. Well, it's using multi-threads but it's up to the OS to distribute it over the CPU cores - which it isn't doing well, being Apple and all (Leopard on the box - can't upgrade).For the Ruby 1.8 series at least with the normal reference implementation, IIRC threads don't run in parallel, it basically just has a scheduler in the vm which timeslices; "green threads" in ruby parlance.
Maybe it's similar to the whole GIL Python thing.
This is obviously crap from the point of view of parallel programming - I think I read proper threads are in 1.9?
but it's up to the OS to distribute it over the CPU cores - which it isn't doing well, being Apple and all (Leopard on the box - can't upgrade).
Well on my laptop (Snow Leopard) it performs *much* better, but it only has two slower cores. The mac desktop (Leopard) has 8 faster cores, but it can't hold it's own when multi-threaded, the Windows desktop (2 slowest cores) fairs quite well. Maybe it's a 64bit thing, me, or Ruby, or whatever, but it's odd.Seriously? I had no idea that OSX was also useless at multi-threading?![]()
I think it could be. 1.9.1 definitely runs better on SL than L.Maybe it's a Ruby interpreter issue, dunno though.
I maybe a little late to this thread, but I'll add it's usually worth batching the disk writes, writing say a 1000 checksums at time. Should give you better throughput as your not waiting for disk round-trip each time after a thread finishes calculating a checksum.
akakjs