Hey Marko, I've been checking you parallel version and it seems quite
nice, I'm starting to catch up with how interfacing via types is done
in Go and how simple is to implement interfaces and just send them to
methods, it's a nice way of duck typing. Also I need to check on
channels!! Those things look amazing. Anyway now I see how a
concurrent implementation looks like, just a question about the other
part. You mentioned 3 things to achieve:
a) scanning the input file once
b) avoid to keep the whole input file in memory
c) possibly parallelize hash calculation on multiple cpus
And actually said that a+b are the most important (I agree) but that
those 2 were solved. But afterwards in the benchmarks you do mention
that the biggish file is cached in memory. I want to say that
io.File.Read implementantion and io.Copy method to hash.Hash.Write
implementation are buffered and parallel, but even if I haven't
checked the code, I'm pretty sure they aren't. Read will usually read
the whole file into memory and then Copy it via MultiWriter or
ParallelWriter to process and Output. There should be used a buffered
read implementation of the file (for video files larger than 1GB or
even distro files and ISO's larger than 4GB that usually require SHA1
calcs) so that you only have 1 piece of the file in the buffer, send
it to the writers and read some more, can that be done via channels??
Also, it is my understanding that buffered method will of course mess
up parallel method because not all algorithms calculate at the same
time, and without having all the file in memory to feed each
algorithm, you'll be waiting for the slower one to finish.
Anyway I want to say thanks a lot to both You and Kyle, I've been
learning a lot and Fast! Be reading you soon around.
Go Nuts!
Guillermo
On Jun 10, 8:02 pm, Marko Mikulicic <
marko.mikuli...@isti.cnr.it>
wrote:
> *GOMAXPROCS env var > 1 (or a call to runtime.GOMAXPROCS(..)).*
> *
> *
> *In practice there are issues regarding 1) termination 2) error handling.*
> *
> *
> *This could be solved if we implement *WriteCloser instead of just write.