Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 110247 Details for
Bug 244444
[performance] always reloading XHTML DTDs slows down processing of many files
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
proposed patch
xhtml-xhtmlassoc-perf.patch (text/plain), 4.50 KB, created by
Nitin Dahyabhai
on 2008-08-18 12:32:11 EDT
(
hide
)
Description:
proposed patch
Filename:
MIME Type:
Creator:
Nitin Dahyabhai
Created:
2008-08-18 12:32:11 EDT
Size:
4.50 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.wst.html.core >Index: src/org/eclipse/wst/html/core/internal/modelquery/XHTMLAssociationProvider.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/modelquery/XHTMLAssociationProvider.java,v >retrieving revision 1.9 >diff -u -r1.9 XHTMLAssociationProvider.java >--- src/org/eclipse/wst/html/core/internal/modelquery/XHTMLAssociationProvider.java 18 Apr 2007 14:51:40 -0000 1.9 >+++ src/org/eclipse/wst/html/core/internal/modelquery/XHTMLAssociationProvider.java 15 Aug 2008 19:08:44 -0000 >@@ -11,6 +11,16 @@ > package org.eclipse.wst.html.core.internal.modelquery; > > >+import java.lang.ref.Reference; >+import java.lang.ref.SoftReference; >+import java.util.Collection; >+import java.util.HashMap; >+import java.util.HashSet; >+import java.util.Map; >+ >+import org.eclipse.core.runtime.IConfigurationElement; >+import org.eclipse.core.runtime.IExtension; >+import org.eclipse.core.runtime.Platform; > import org.eclipse.wst.common.uriresolver.internal.provisional.URIResolver; > import org.eclipse.wst.xml.core.internal.contentmodel.CMDocument; > import org.eclipse.wst.xml.core.internal.contentmodel.modelquery.CMDocumentManager; >@@ -26,6 +36,15 @@ > * This class closely resemble XMLModelQueryAssociationProvider. > */ > class XHTMLAssociationProvider extends XMLAssociationProvider { >+ >+ /** >+ * set CACHE_FIXED_DOCUMENTS to false to test effects of not caching certain catalog-contributed schemas. >+ */ >+ private static final boolean CACHE_FIXED_DOCUMENTS = true; >+ private static final String[] STANDARD_SCHEMA_BUNDLES = new String[] {"org.eclipse.wst.standard.schemas","org.eclipse.jst.standard.schemas"}; >+ private static final String XML_CATALOG_EXT_POINT = "org.eclipse.wst.xml.core.catalogContributions"; >+ private static Collection fFixedPublicIDs = null; >+ private static Map fFixedCMDocuments = new HashMap(); > > /** > * set USE_QUICK_CACHE to false to test effects of not caching at all. >@@ -59,6 +78,7 @@ > public CMDocument getXHTMLCMDocument(String publicId, String systemId) { > if (idResolver == null) > return null; >+ > String grammerURI = null; > if (USE_QUICK_CACHE) { > /* >@@ -84,7 +104,18 @@ > > if (grammerURI == null) > return null; >- >+ >+ CMDocument cmDocument = null; >+ if (CACHE_FIXED_DOCUMENTS) { >+ Reference ref = (Reference) fFixedCMDocuments.get(publicId); >+ if (ref != null) { >+ cmDocument = (CMDocument) ref.get(); >+ if (cmDocument != null) { >+ return cmDocument; >+ } >+ } >+ } >+ > /* > * https://bugs.eclipse.org/bugs/show_bug.cgi?id=88896 > * >@@ -105,7 +136,14 @@ > * grammerURI); CMDocument cmDocument = > * documentManager.getCMDocument(publicId, grammerURI, "dtd"); > */ >- CMDocument cmDocument = documentManager.getCMDocument(publicId, grammerURI, null); >+ synchronized (grammerURI) { >+ cmDocument = documentManager.getCMDocument(publicId, grammerURI, null); >+ } >+ >+ if (CACHE_FIXED_DOCUMENTS && getFixedPublicIDs().contains(publicId)) { >+ fFixedCMDocuments.put(publicId, new SoftReference(cmDocument)); >+ } >+ > return cmDocument; > } > >@@ -134,4 +172,38 @@ > public String getCachedGrammerURI() { > return fCachedGrammerURI; > } >+ >+ /** >+ * @return the fFixedPublicIDs, a collection of contributed Public >+ * Identifiers from the known schema plug-ins. >+ */ >+ private static Collection getFixedPublicIDs() { >+ /** >+ * public:publicId >+ * TODO: system:systemId and uri:name in their own methods and maps? >+ */ >+ synchronized (STANDARD_SCHEMA_BUNDLES) { >+ if (fFixedPublicIDs == null) { >+ fFixedPublicIDs = new HashSet(); >+ for (int i = 0; i < STANDARD_SCHEMA_BUNDLES.length; i++) { >+ IExtension[] extensions = Platform.getExtensionRegistry().getExtensions(STANDARD_SCHEMA_BUNDLES[i]); >+ for (int j = 0; j < extensions.length; j++) { >+ if (XML_CATALOG_EXT_POINT.equals(extensions[j].getExtensionPointUniqueIdentifier())) { >+ IConfigurationElement[] configurationElements = extensions[j].getConfigurationElements(); >+ for (int k = 0; k < configurationElements.length; k++) { >+ IConfigurationElement[] publics = configurationElements[k].getChildren("public"); >+ for (int l = 0; l < publics.length; l++) { >+ String publicId = publics[l].getAttribute("publicId"); >+ if (publicId != null && publicId.length() > 0) { >+ fFixedPublicIDs.add(publicId); >+ } >+ } >+ } >+ } >+ } >+ } >+ } >+ } >+ return fFixedPublicIDs; >+ } > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 244444
: 110247