The general optimization problem is the packing problem, NP-complete. So no 
fast optimal solution exists.
But fast-enough, suboptimal does. Search for a sat-solver.

Btw time of computing md5 is size-dependent, so sort by size in descending 
order, and use a buffered channel as token bucket, with a predefined token 
"size".
For example if you measure that a 1Mb file needs 128k memory, then use a token 
for each mb of file, and limit bucket size by memory limit in 128k units.

If bucket is not big enough for the file, try the next (smaller).
But if you start a goroutine for each file, and the bucket uses channels, 
eventually reducing the selection to a "select", you'll get a suboptimal but 
easy and reasonable solution.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to