Re: gpars for calculating directory content size

2017-06-16 Thread Russel Winder
On Fri, 2017-06-16 at 14:55 +, Merlin Beedell wrote:
> I see that groovy has a handy method to return the sum of file & sub-
> directory sizes in a directory:
> new File('sample').directorySize()
> 
> But I would be interested to see if the underlying code uses gpars -
> on the assumption that the computation would be faster if sub-
> directories are found (the sum of each being performed in parallel).

No it just uses eachFileRecurse which is a single threaded recursive
walk over a file system.

 |> time du -s .
340380  .

real0m0.033s
user0m0.007s
sys 0m0.026s

|> time groovy -e "println(new File('.').directorySize())"
332167942

real0m1.215s
user0m2.081s
sys 0m0.169s

I am sure you could do a fork/join version of eachFileRecurse, but I am
not sure there is one.

[…]
-- 
Russel.
=
Dr Russel Winder  t: +44 20 7585 2200   voip: sip:russel.win...@ekiga.net
41 Buckmaster Roadm: +44 7770 465 077   xmpp: rus...@winder.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder

signature.asc
Description: This is a digitally signed message part


gpars for calculating directory content size

2017-06-16 Thread Merlin Beedell
I see that groovy has a handy method to return the sum of file & sub-directory 
sizes in a directory:
new File('sample').directorySize()

But I would be interested to see if the underlying code uses gpars - on the 
assumption that the computation would be faster if sub-directories are found 
(the sum of each being performed in parallel).

Actually - my interest is more in seeing a useful(?) example of gpars!

Merlin Beedell

[https://www.cryoserver.com/wp-content/uploads/2017/03/ISO-logo-signature.jpg]  
[https://www.cryoserver.com/wp-content/uploads/2017/03/softech-signature.png]   
[https://www.cryoserver.com/wp-content/uploads/2017/03/ITE-signature.png]

FCS (UK) Limited is registered in England & Wales, Registration Number: 5940018 
- Registered Address: Wigglesworth House, 69 Southwark Bridge Road, London SE1 
9HH Disclaimer: This e-mail contains proprietary information, some or all of 
which may be legally privileged and is for the intended recipient only and the 
information in it are provided in confidence and may not be disclosed to any 
third party or used for any other purpose without the express permission of FCS 
(UK) Ltd. If an addressing or transmission error has misdirected this e-mail, 
please notify the author by replying. If you are not the intended recipient you 
should not use, disclose, distribute, copy, print or relay on this e-mail. The 
views expressed in this communication are not necessarily the views held by FCS 
(UK) Limited.