On 5 January 2015 at 13:43, Stefan Bodewig <bode...@apache.org> wrote: > On 2015-01-04, Kristian Rosenvold wrote: > >> Most surprising to me is that it seems like the overhead of lots of >> small calls to RandomAccessFile.write seems to be a lot costlier than >> I thought it would be. It seems like consolidating to a larger byte >> array before calling write is a *lot* faster. > > This surprises me as well.
Could be due to need to lock data in memory in native code. This usually means data has to be copied to a safe buffer. A single large copy will be faster than lots of small ones. >> So in some places where the upper memory constraint is known (like >> writing the central directory), it seems to make a lot of sense to do >> it in a single/a few writes. > > Makes sense. > >> I'm also looking at modifications to write the full file single pass >> (without seek operations for sizes), it's reasonably expensive to do >> all that seeking to establish information we already have. > > I'm not sure I understand where you are heading, but I'll see when you > are ready :-) > > Cheers > > Stefan > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org > For additional commands, e-mail: dev-h...@commons.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org