Bug 136921 - [IDE] New File dialog locks for 20 seconds
Summary: [IDE] New File dialog locks for 20 seconds
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.2 RC2   Edit
Assignee: Tod Creasey CLA
QA Contact:
URL:
Whiteboard:
Keywords: greatbug, performance
Depends on:
Blocks:
 
Reported: 2006-04-15 23:18 EDT by Igor Fedorenko CLA
Modified: 2006-04-25 15:19 EDT (History)
1 user (show)

See Also:


Attachments
CPU statistics (101.30 KB, text/html)
2006-04-16 00:03 EDT, Igor Fedorenko CLA
no flags Details
stack trace while the dialog is locked (12.63 KB, text/plain)
2006-04-17 10:44 EDT, Igor Fedorenko CLA
no flags Details
possible fix (988 bytes, patch)
2006-04-17 11:34 EDT, Igor Fedorenko CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Igor Fedorenko CLA 2006-04-15 23:18:40 EDT
I have fairly large workspace (many thousands files in 150+ projects). Whenever I try to create a new file, "New File" dialog stays locked for 15-20 seconds before I can start typing file name. CPU utilization is 100% during this time.

Eclipse 3.2 I20060331-2000, WinXP SP2, tried with both IBM Java 1.5.0 SR1 and SUN 1.5.0_05.
Comment 1 Igor Fedorenko CLA 2006-04-16 00:03:26 EDT
Created attachment 38644 [details]
CPU statistics

Not sure how trustworthy this data is, but here is where the time is spent according to Yourkit profiler. As you can see, the problem seems to be related to some label decoration activities happenning in the UI thread, and indeed, disabling all label decoration makes the problem go away.
Comment 2 Boris Bokowski CLA 2006-04-16 00:21:19 EDT
Thanks for the profiling data!

Do you know if this performance problem is new in 3.2?
Comment 3 Igor Fedorenko CLA 2006-04-16 23:28:57 EDT
I believe it is a recent regression, 3.1.2 does not have this problem and I do not remember anything like this in 3.2M4 either.

I setup test CVS repository you can use to reproduce the problem (nothing fency, just 150 java projects with couple of classes each). Please email me directly if you want to access it.
Comment 4 Tod Creasey CLA 2006-04-17 09:42:45 EDT
Could you possibly attach a stack trace? It is most likely an issue with someone locking the workspace while you are creating the file rather than the decorators.

If you run with the -consolelog option you will get a window that will allow you to get a stack trace with a control break
Comment 5 Igor Fedorenko CLA 2006-04-17 10:44:15 EDT
Created attachment 38673 [details]
stack trace while the dialog is locked

StructuredViewer.update(Object[], String[]) uses unscalable ON^2 algorithm. With 150 projects this results in 20k+ iterations. It also seems that this method is called two (or more) times when I open new file dialog. Just an observation...
Comment 6 Igor Fedorenko CLA 2006-04-17 11:34:39 EDT
Created attachment 38681 [details]
possible fix

Not sure if there is more to this problem, but this one-line patch makes NewFile dialog usable virtually instantaneously.
Comment 7 Tod Creasey CLA 2006-04-17 11:46:11 EDT
Spot on Igor - if you don't use hash lookup the lookup goes from O(1) to O(n) for each lookup. I think you are spot on - I'll see this gets into 3.2.

Thanks for all of your help.
Comment 8 Tod Creasey CLA 2006-04-18 11:10:12 EDT
Marking fixed
Comment 9 Tod Creasey CLA 2006-04-25 15:19:20 EDT
Verified in 20050425