Community
Participate
Working Groups
Build Identifier: 20110916-0149 m2e-wtp uses a custom IVirtualComponent, OverlayVirtualComponent, to handle War Overlays à-la-Maven. OverlayVirtualComponent.getRootFolder() method is somewhat slow, as it treewalks the overlay graph to build it's resource tree -It may be a BAD thing, but that's not really the point-. However, I see that getRootFolder() method is called way more than necessary. Turns out the current FlatVirtualComponent.consumeComponent(...) calls it twice, as you can see : protected void consumeComponent(VirtualComponentFlattenUtility util, IPath root, IVirtualReference reference) throws CoreException { IVirtualComponent consumedComponent = reference.getReferencedComponent(); if (consumedComponent.getRootFolder()!=null) { IVirtualFolder vFolder = consumedComponent.getRootFolder(); util.addMembers(consumedComponent, vFolder, root.append(reference.getRuntimePath().makeRelative())); addConsumedReferences(util, consumedComponent, root.append(reference.getRuntimePath().makeRelative())); addUsedReferences(util, consumedComponent, root.append(reference.getRuntimePath().makeRelative())); } } I think it can safely be refactored to : protected void consumeComponent(VirtualComponentFlattenUtility util, IPath root, IVirtualReference reference) throws CoreException { IVirtualComponent consumedComponent = reference.getReferencedComponent(); IVirtualFolder vFolder = consumedComponent.getRootFolder(); if (vFolder!=null) { util.addMembers(consumedComponent, vFolder, root.append(reference.getRuntimePath().makeRelative())); addConsumedReferences(util, consumedComponent, root.append(reference.getRuntimePath().makeRelative())); addUsedReferences(util, consumedComponent, root.append(reference.getRuntimePath().makeRelative())); } } Reproducible: Always
Created attachment 209606 [details] Micro-optipatch ;) Patch as per the comments by fred
I like the change - thanks!
Committed and released to head and 3.3.2