harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Hindess <mark.hind...@googlemail.com>
Subject Re: interesting commentary via android bug report
Date Wed, 13 Jan 2010 10:18:35 GMT

In message <4B4D6601.6030507@gmail.com>, Regis writes:
>
> On 2010-01-13 13:49, Jesse Wilson wrote:
> > On Tue, Jan 12, 2010 at 7:47 PM, Charles Lee<littlee1032@gmail.com>  wrote:
> >
> >> What's the reason of bad idea? limited memory?
> >>
> >
> > A cache that cannot be cleared is a disservice to users. It's an error in
> > our implementation (and the RI!) to assume that an application requesting
> > the canonical path two times wants to receive the same result. If the
> > application wants the same value, why doesn't the *application* cache the
> > result?!
> 
> canonical path is heavily used when checking file permission. So if
> a SecurityManager is installed, canonical path will be calculated by
> every file operation at least once, that the killer of performance,
> application cache can't help that.
> 
> >
> > If we want to make Harmony faster, there are better ways to do so. The
> > simpler optimization is to streamline the code that looks up the canonical
> > path *the first time*. Reducing the number of times we cross a JNI boundary
> > is one of many opportunities here.
> 
> Yes, as I know resolving symbol links part on Linux can be done in one
> JNI call.  But it's not conflict with the cache.

There are two obvious areas for improvement here:

1) moving the loop around the readlink function to native code to reduce
the JNI calls,

2) using the realpath syscall on platforms that support it to reduce the
number of syscalls

We should definitely do 1) (particularly as this is platform independent).

I think the realpath syscall is quite portable (using the second
parameter non-NULL which we'd want to use anyway) on Linux, Aix and
z/OS.  So unless there is a compelling reason not to use realpath we
should probably do 2) also.

While I agree with Jesse that it is a bad idea to have a cache with no
API o control it. the RI uses one so I think we'd be at a significant
disadvantage if we didn't use one as well.

It would be good to make the possible improvements and then confirm that
the disadvantage really is significant in practice.

Regards,
 Mark.



Mime
View raw message