Community
Participate
Working Groups
Method CDOResourceImpl.getURI() can take tens of milliseconds to execute, for resources with about ten parent folders. Given that this method can be extensively on operations such as AbstractCDOView.newResourceInstance() it perfomance is quite important. I'm attaching a profiler screenshot to illustrate the problem. Discussion is here: https://www.eclipse.org/forums/index.php/t/802305/
Created attachment 246350 [details] Profiling result
After some research, I came with the following analysis: It's not getURI() itself causing low performance, it's newResourceInstance(), that iterates over all loaded resources (three times). So, for loading large amount of resources, algorithm becomes effectively quadratic. I've done an experimental optimization using EMF ResourceLocator mechanism, and it works wonders. Here is how it works: it maintains a cache of URI -> Resource (normal hash map). It also attaches itself as CDOObject handler to each view, that are in its resourceSets viewSet. When a CDOResourceNode goes to a NEW or CLEAN state, it attaches an adapter to it. Adapter listens to notifications in its 'folder' and 'name' features, and whenever one changes it sets a flag 'updateCacheOnNextGetResource'. In getResource method it checks the flag, and if it's set, it recalculates the URI's for all already cached resources. After this it's O(1) to check if a resource exists, and return or create a new one. Unfortunately, that's not enough. CDO iterates over all resources in org.eclipse.emf.internal.cdo.view.AbstractCDOView.ensureURIs(ResourceSet), bypassing ResouceSetImpl.getResource(). It's said that it fixes bug 337523. But, after I commented it out, test for this bug still passes, so it's probably safe to remove.
Hi Leonid, Thanks for the analysis. If you contribute a Gerrit review I'Ll probably find some time to review it and research why ensureURIs() no longer seems needed.
Moving all open bugzillas to 4.5.
Moving all unaddressed bugzillas to 4.6.
Moving all open bugs to 4.7
Moving all unresolved issues to version 4.8-
Moving all unresolved issues to version 4.9
Moving to 4.13.