Community
Participate
Working Groups
Build Identifier: M20100909-0800 I'm developing an Eclipse-based editor, which uses IResource.createMarker() for error marking, and faced with problem - if a document contains too many errors (say > 1000) my editor becomes very slow and almost unusable. After debugging (the stack is below) I've found out that the cause of the performance degradation is org.eclipse.core.internal.resources.Marker.setAttributes() which causes a new short-living thread creation on each call. Thus, if there are > 1000 errors, > 1000 threads are created. To fix the issue I would propose to use a short-living thread pool instead of a new thread creation. Here is the stack trace: ProjectionSummary$Summarizer(Thread).init(ThreadGroup, Runnable, String, long) line: 312 ProjectionSummary$Summarizer(Thread).<init>() line: 377 ProjectionSummary$Summarizer.<init>(ProjectionSummary) line: 47 ProjectionSummary.updateSummaries() line: 144 ProjectionViewer$AnnotationModelListener.processModelChanged(IAnnotationModel, AnnotationModelEvent) line: 127 ProjectionViewer$AnnotationModelListener.modelChanged(AnnotationModelEvent) line: 116 AnnotationModel.fireModelChanged(AnnotationModelEvent) line: 612 AnnotationModel$InternalModelListener.modelChanged(AnnotationModelEvent) line: 261 StructuredResourceMarkerAnnotationModel(AnnotationModel).fireModelChanged(AnnotationModelEvent) line: 612 StructuredResourceMarkerAnnotationModel(AnnotationModel).fireModelChanged() line: 578 StructuredResourceMarkerAnnotationModel(ResourceMarkerAnnotationModel).update(IMarkerDelta[]) line: 114 ResourceMarkerAnnotationModel$ResourceChangeListener.resourceChanged(IResourceChangeEvent) line: 56 NotificationManager$2.run() line: 291 SafeRunner.run(ISafeRunnable) line: 42 NotificationManager.notify(ResourceChangeListenerList$ListenerEntry[], IResourceChangeEvent, boolean) line: 285 NotificationManager.broadcastChanges(ElementTree, ResourceChangeEvent, boolean) line: 149 Workspace.broadcastPostChange() line: 327 Workspace.endOperation(ISchedulingRule, boolean, IProgressMonitor) line: 1181 Marker.setAttributes(Map) line: 315 Reproducible: Always Steps to Reproduce: IResource file; Map<String, Object> map = new HashMap<String, Object>(6); MarkerUtilities.setMessage(map, message); MarkerUtilities.setCharStart(map, start); MarkerUtilities.setCharEnd(map, end); map.put(IMarker.LOCATION, file.getLocationURI().toString()); map.put(IMarker.SEVERITY, severity); IMarker marker = file.createMarker(IMarker.PROBLEM) marker.setAttributes(map);
Summarizer Thread is used by ProjectionSummary from JFace Text.
You should create your markers inside a workspace runnable so that only one delta is sent out at the end.