Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 135633

Summary: LogView sort is extremely slow especially that it uses the SimpleDateFormat
Product: [Eclipse Project] PDE Reporter: Yasser Lulu <ylulu>
Component: UIAssignee: Janek Lasocki-Biczysko <janek.lb>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: baumanbr, janek.lb, loskutov, wassim.melhem
Version: 3.2   
Target Milestone: 3.4 M3   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
LogEntrys will now store a formatted date string, in addtion to a Date object, for faster label providing none

Description Yasser Lulu CLA 2006-04-07 15:09:24 EDT
The LogView comparator used by its viewer is very slow, it instantaiates a SimpleDateFormat every singlt time compare is called and uses it to format dates and compare them.
Comment 1 Janek Lasocki-Biczysko CLA 2006-04-07 17:35:37 EDT
Quoting Wassim:
perhaps we should store a long timestamp in the log entry itself, so that sorting by date becomes easier
Comment 2 Janek Lasocki-Biczysko CLA 2006-04-12 14:49:24 EDT
Fixed
Comment 3 Andrey Loskutov CLA 2007-10-01 09:03:55 EDT
I could not understood why this bug is marked as fixed: the code:

DateFormat formatter = new SimpleDateFormat(LogEntry.F_DATE_FORMAT);
return formatter.format(entry.getDate());

Still exists in LogViewLabelProvider and used in both Eclipse 3.2.1 and 3.3 ?!?

Please reopen this bug or fix it (fix is very simply: just store used SimpleDataFormat instance to the field of LogViewLabelProvider) ;-)

We see huge Eclipse performance problems and 100% CPU load for a long time, if application generates "too much" (> 20) errors and PDE error view is opened at same time.

Each time JVM stack trace is related to LogViewLabelProvider & SimpleDataFormat:

 - com.ibm.icu.impl.ICUResourceBundle.findResourceWithFallback(java.lang.String, com.ibm.icu.impl.ICUResourceBundle, com.ibm.icu.impl.ICUResourceBundle) @bci=12, line=1101 (Compiled frame)
 - com.ibm.icu.impl.ICUResourceBundle.getWithFallback(java.lang.String) @bci=7, line=652 (Compiled frame)
 - com.ibm.icu.impl.CalendarData.get(java.lang.String, java.lang.String, java.lang.String) @bci=53, line=95 (Compiled frame)
 - com.ibm.icu.impl.CalendarData.getStringArray(java.lang.String, java.lang.String, java.lang.String) @bci=4, line=114 (Compiled frame)
 - com.ibm.icu.text.DateFormatSymbols.initializeData(com.ibm.icu.util.ULocale, java.lang.String) @bci=13, line=791 (Compiled frame)
 - com.ibm.icu.text.SimpleDateFormat.<init>(java.lang.String, com.ibm.icu.util.ULocale) @bci=28, line=341 (Compiled frame)
 - com.ibm.icu.text.SimpleDateFormat.<init>(java.lang.String) @bci=5, line=317 (Compiled frame)
 - org.eclipse.jface.viewers.TreeViewer.doUpdateItem(org.eclipse.swt.widgets.Item, java.lang.Object) @bci=385, line=309 (Compiled frame)
 - org.eclipse.jface.viewers.AbstractTreeViewer$UpdateItemSafeRunnable.run() @bci=12, line=95 (Compiled frame)
 - org.eclipse.core.runtime.SafeRunner.run(org.eclipse.core.runtime.ISafeRunnable) @bci=5, line=37 (Compiled frame)
 - org.eclipse.core.runtime.Platform.run(org.eclipse.core.runtime.ISafeRunnable) @bci=1, line=843 (Compiled frame)
 - org.eclipse.jface.viewers.StructuredViewer$UpdateItemSafeRunnable.run() @bci=16, line=465 (Compiled frame)
 - org.eclipse.core.runtime.SafeRunner.run(org.eclipse.core.runtime.ISafeRunnable) @bci=5, line=37 (Compiled frame)
 - org.eclipse.core.runtime.Platform.run(org.eclipse.core.runtime.ISafeRunnable) @bci=1, line=843 (Compiled frame)
 - org.eclipse.jface.viewers.AbstractTreeViewer.internalRefreshStruct(org.eclipse.swt.widgets.Widget, java.lang.Object, boolean) @bci=5, line=1651 (Compiled frame)
 - org.eclipse.jface.viewers.TreeViewer.internalRefreshStruct(org.eclipse.swt.widgets.Widget, java.lang.Object, boolean) @bci=58, line=955 (Compiled frame)
 - org.eclipse.jface.viewers.AbstractTreeViewer.internalRefresh(org.eclipse.swt.widgets.Widget, java.lang.Object, boolean, boolean) @bci=65, line=1627 (Compiled frame)
 - org.eclipse.jface.viewers.AbstractTreeViewer.internalRefresh(java.lang.Object, boolean) @bci=44, line=1582 (Interpreted frame)
 - org.eclipse.jface.viewers.AbstractTreeViewer.internalRefresh(java.lang.Object) @bci=3, line=1568 (Interpreted frame)
 - org.eclipse.jface.viewers.StructuredViewer$7.run() @bci=8, line=1388 (Interpreted frame)
 - org.eclipse.jface.viewers.StructuredViewer.preservingSelection(java.lang.Runnable) @bci=18, line=1323 (Interpreted frame)
 - org.eclipse.jface.viewers.StructuredViewer.refresh(java.lang.Object) @bci=10, line=1386 (Interpreted frame)
 - org.eclipse.jface.viewers.StructuredViewer.refresh() @bci=5, line=1345 (Interpreted frame)
 - org.eclipse.pde.internal.runtime.logview.LogView$20.run() @bci=20, line=670 (Interpreted frame)
 - org.eclipse.swt.widgets.RunnableLock.run() @bci=11, line=35 (Compiled frame)
 - org.eclipse.swt.widgets.Display.runAsyncMessages(boolean) @bci=5, line=3143 (Compiled frame)
 - org.eclipse.ui.internal.Workbench.runEventLoop(org.eclipse.jface.window.Window$IExceptionHandler, org.eclipse.swt.widgets.Display) @bci=9, line=1914 (Compiled frame)
 - org.eclipse.ui.internal.Workbench.runUI() @bci=225, line=1878 (Interpreted frame)
Comment 4 Brian Bauman CLA 2007-10-01 10:45:00 EDT
The bug was marked as fixed because we reduced the amount of SimpleDateFormats we instantiated.  We fixed the code in the comparator which was the original bug.

Your request makes sense.  So I am going to reopen the bug so we can see what we can do to further enhance performance.
Comment 5 Brian Bauman CLA 2007-10-01 10:46:50 EDT
Chris, since you already did the refactoring work for the Log View, I didn't want to drop too much code before you get a chance to commit it.  So can you take a look at this bug when you are finishing off the refactoring?
Comment 6 Chris Aniszczyk CLA 2007-10-01 10:49:48 EDT
targetting towards M3
Comment 7 Janek Lasocki-Biczysko CLA 2007-10-01 10:55:55 EDT
Sorry to jump in so late, but I saw this in my inbox this morning and started working on it. Its almost done - if you guys haven't done the work yourselves yet let me know and I'll commit my changes shortly.
Comment 8 Brian Bauman CLA 2007-10-01 11:14:52 EDT
If you are almost done, I sure am not going to stop you :)

Do me a favor and post a patch in addition to committing your changes.  I can see if I can include the changes in the refactoring patch Chris has so we can include this fix when we move the Log View.
Comment 9 Janek Lasocki-Biczysko CLA 2007-10-01 11:18:27 EDT
Created attachment 79486 [details]
LogEntrys will now store a formatted date string, in addtion to a Date object, for faster label providing
Comment 10 Janek Lasocki-Biczysko CLA 2007-10-01 11:21:00 EDT
Alright, the new code has been tested/applied (and the performance is better)
See the patch above - thanks for letting me squeeze this one in - it was my fault for missing it in the 1st place.
Comment 11 Brian Bauman CLA 2007-10-01 16:10:06 EDT
Thanks Janek for taking care of this bug.  We appreciate it :)

I went ahead and included it in the patch Chris had for refactoring the Error Log View into a separate plug-in, so we would not lose this fix.  Marking as fix since it is in HEAD and in Chris's refactoring patch.