DevMode uses single top level ModuleDef with single set of jars.

GWT Designer can open several editors with several top level ModuleDefs,
which use several may be different sets of jars, but with many
intersections.

If only we could have hashCode() and equals() for PathPrefixSet... This
would allow not only cashing and reusing indexed jars, but also results
of resource requests - another 15% of performance...


http://gwt-code-reviews.appspot.com/1388803/diff/1/dev/core/src/com/google/gwt/dev/resource/impl/ZipFileClassPathEntry.java
File
dev/core/src/com/google/gwt/dev/resource/impl/ZipFileClassPathEntry.java
(right):

http://gwt-code-reviews.appspot.com/1388803/diff/1/dev/core/src/com/google/gwt/dev/resource/impl/ZipFileClassPathEntry.java#newcode85
dev/core/src/com/google/gwt/dev/resource/impl/ZipFileClassPathEntry.java:85:
private static final Map<String, ZipFileCachedEntry> entryCache = new
ReferenceMap(
WeakHashMap is for weak reference on key.
SoftReference is for memory-sensitive cache.

http://gwt-code-reviews.appspot.com/1388803/diff/1/dev/core/src/com/google/gwt/dev/resource/impl/ZipFileClassPathEntry.java#newcode98
dev/core/src/com/google/gwt/dev/resource/impl/ZipFileClassPathEntry.java:98:
entryCache.put(location, cachedEntry);
In reality memory consumption is lower with caching.
We don't generate new ZipFileClassPathEntry with all its ZipResources.

With cache: 14 instances, 8.5MB
Without cache: 30 instances, 29MB

Cache prevents creating several instances for same jar.
Keep in mind difference of DevMove and DesignMode. First uses fixed set
of jars in classpath. Second uses several set of jars, possibly
different in different editors, but often there are same jars. Most
prominent of these "same jars" in JRE jars (which may be should not be
indexed at all) and gwt-user.jar if all GWT modules of user use same
version of GWT.

Check isStale() is mostly paranoidal - what if user closed all its GWT
Designer editors and replaced some jar with newer version, but using
same name. This almost never happens, but it is easy and cheap to
implement such check. It is not possible to have several versions of
same jar - if they have same URI, then old one was replaced with newer.

You are right about synchronization. It is required for entryCache and
also for findApplicableResources().

http://gwt-code-reviews.appspot.com/1388803/

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to