Library.listClasses

Mark Reinhold mr at sun.com
Wed Nov 11 11:26:40 PST 2009


> Date: Wed, 11 Nov 2009 11:09:13 -0800
> From: jonathan.gibbons at sun.com

> Is Library.listClasses likely to be a light-weight or an expensive operation?

Right now it's fairly expensive.  It doesn't do even the simplest kinds
of caching; I could fix that easily if needed sooner rather than later.

In the long run it'll be pretty fast, even on the first invocation, once
we optimize the on-disk installed-module format.

> javac needs to list the classes on a package-by-package basis, so if
> listClasses is cheap (or if repeated calls are cheap), then I can run
> listClasses every time and filter the output. But if the  method is expensive,
> then I will likely have to cache the results.

Even in the long run I suspect that a listClasses(String packageName)
method will be cheaper than the listClasses() method.

I suggest that for now you don't cache this information in the compiler.
If performance proves to be an early issue then I'll address it in the
library code.

- Mark



More information about the jigsaw-dev mailing list