Hello, I have recently been using the x/image/riff library to inspect some large RIFF files - typically I am interested in all chunks except the data chunk. I have found with large files the performance is quite poor. Looking into the code it does a `got, z.err = io.Copy(ioutil.Discard, z.chunkReader)` to get the Reader into the right place if the previous chunk data has not been fully read/drained. For an *os.File, this can understandably be very slow if the chunk data is large. I have found if I do a type assertion for io.ReadSeeker on the underlying Reader and Seek instead, in that case the performance is dramatically improved (a 99% improvement in CPU time in a benchmark with a 128MB file). There can also be an optimisation to recognise when a chunk is the last chunk and therefore not need to drain it (can be significant for many media RIFF types which tend to put the large data chunk last) before returning io.EOF, but with the Seek optimisation this is less significant.
I can attach the diff. It's rather small. Is this something that is worth contribution? I'd rather not maintain a branch, though this would be my first contribution, so require some setup I'd rather not do if this isn't considered worth contributing. Thanks, Alex -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/efaa2b5a-53df-4225-b2b2-85cd0c194210n%40googlegroups.com.