harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Regis <xu.re...@gmail.com>
Subject [classlib] add cache for file's canonical path
Date Thu, 07 May 2009 08:38:07 GMT
Hi,

Recently I'm trying to optimize implementation of java.File, and find 
File.getCanonicalPath is very time cost and is heavily used by checking file 
permission. But in the most of cases, the canonical path is never change, so I 
think it's better to cache them to avoid calculate every time. And I found RI 
also has cache: File.getCanonicalPath doesn't reflect change in file system 
real-time.

I have created a JIRA HARMONY-6200 for this, and attach a simple cache 
implementation for file's canonical path, someone interested in this may can 
help to review it.

The cache has fixed size, when it's full oldest element would be remove, and 
elements would be expired in 10 minutes, that mean if the element stay in cache 
more than 10 minutes, it's not validate and will be removed.

It's a initial implementation, I believe there are still many places can be 
improved, any comments and suggestions are welcome.

-- 
Best Regards,
Regis.

Mime
View raw message