This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Class Annotations has a sorted by line number annotation storage. But when annotation is added the sequential search is used. It a wast of time. For example: adding of 1500 annotations consume about 2 seconds. See code fragment: ------------------------------------------------ // insert newly created LineAnnotations into sorted array boolean inserted = false; for (int i=0; i < lineAnnotationsArray.size(); i++) { if (((LineAnnotations)lineAnnotationsArray.get(i)).getLine() > lineAnnos.getLine()) { lineAnnotationsArray.add(i, lineAnnos); inserted = true; break; } } if (!inserted) lineAnnotationsArray.add(lineAnnos); ------------------------------------------------
Yeahm, it sounds rather inefficient.
I'll look at it for 7.0
*** Bug 183610 has been marked as a duplicate of this bug. ***
Created attachment 98745 [details] Patch for testing.
Alexander, could you please try the above patch? The change is that binary search is used when adding annotation. I hope that could bring big enough performance improvement for 6.9. In the future we could think about extending the API, possibly to do something similar as the AnnotationHolder does, which should further improve the performance. Thanks.
(In reply to comment #5) > Alexander, could you please try the above patch? Ok, will try today.
Annotations does not have hot spots now.
Thanks, I have applied the patch: http://hg.netbeans.org/jet-main/rev/36a16ca5f798 I have also filled an enhancement (bug #185928) to cover possible future addition of a method that would allow to set many annotations at once.
Integrated into 'main-golden', will be available in build *201005132200* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/ User: Log: