[jboss-dev] Further profling: Where should I focus?

Andrew Dinn adinn at redhat.com
Wed Jan 6 04:34:32 EST 2010


On 01/05/2010 07:42 PM, Bill Burke wrote:
> public List<Closeable> recursiveMount(VirtualFile file) throws
> IOException
>      {
>         ArrayList<Closeable>  mounts = new ArrayList<Closeable>();
>
>         if (!file.isDirectory()&&
> file.getName().matches("^.*\\.([EeWwJj][Aa][Rr]|[Zz][Ii][Pp])$"))
>            mounts.add(VFS.mountZip(file, file, provider));
>
>         /****** Doubled speedup when this was commented out!!!!!!!!!!!!
>         if (file.isDirectory())
>            for (VirtualFile child : file.getChildren())
>               mounts.addAll(recursiveMount(child));
>               */
>
>
>         return mounts;
>      }

Irrespective of the answer to any general issues over caching it is 
clear in this case that the 2 calls to file.isDirectory() can quite 
legitimately be replaced with a single call and a local variable to 
stash/test the result (it's a shame the compiler cannot figure this out 
but so it goes). Since this code actually turned up in the profiling as 
a major source of overhead then the obvious thing to do in response is 
patch it and see what turns up next then keep going until easy to fix 
things like this stop turning up. Saves us wasting time in protracted 
arguments as well ;-)

regards,


Andrew Dinn
-----------


-- 
regards,


Andrew Dinn
-----------
Senior Software Engineer, JBoss
Red Hat UK Ltd
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire,
SI4 1TE, United Kingdom.
Registered in UK and Wales under Company Registration No. 3798903
Directors: Michael Cunningham (USA), Charlie Peters (USA), Matt Parsons
(USA)  and Brendan Lane (Ireland)






More information about the jboss-development mailing list