performance updates to jar and zip
Xueming Shen
xueming.shen at oracle.com
Thu Oct 27 16:37:45 UTC 2011
On 10/27/2011 06:07 AM, Alan Bateman wrote:
> On 27/10/2011 00:19, Xueming Shen wrote:
>> :
>>
>> Here are the "surprising" results.
>>
>> "nio" is the walkFileTree,
>> "io" is the File.list()
>> "io2" is the File.listFiles().
>>
>> The nio's File.walkFileTree is 15 times faster than the "traditional"
>> recursion+File.list().
>> wow!
>>
> At least for your testing on Linux then if you run with strace then it
> should become clear. The ioIter and ioIter2 methods in the test result
> in each file being stat'ed 3 times whereas with walkFileTree it is
> using Files.readAttributes to attributes in bulk (so one stat per file).
>
> In any case, this is all good work. One suggestion is to consider not
> introducing a -T<n> or whatever option but instead default to using a
> pipeline that has the right number of threads to work very fast in
> most cases. I'm just thinking of jar tasks in ANT or shell scripts
> where you wouldn't want to hard code a thread count.
>
-T is simply here to help measure the performance under different thread
number. Agreed
that this thing should work by default.
-Sherman
More information about the core-libs-dev
mailing list