views:

966

answers:

7

I have a few large (~600k lines of code) Delphi projects. They include some custom components which our team has developed.

Often, when I call up code completion with ctrl+space or just by pressing ".", the IDE locks up and thinks really hard for a long time. Sometimes the delay can be a full minute, or more. Other times, it pops up immediately with suggestions.

What factors influence the performance of intellisense in Delphi? Is there any way I can improve this performance?

My best solution so far is to turn off the automatic completion, and use ctrl+space when I need to meditate quietly for a minute or so.

I can't help but mention that VS2005, VS2008, and XCode all seem to give virtually instant intellisense feedback (although I've never tried it on a project this large).

As an alternative, I've offered this suggestion.

+3  A: 

This is a long-standing issue with Delphi, and I had to resort to turning off automatic completion. After working that way for a while, I was very happy with it. Even if it only takes a fraction of a second, having the IDE lag my typing was disconcerting and interrupted my flow. Much nicer with the automatics off, IMO.

dwc
can't agree with not using `the automatics`...
Peter Perháč
MasterPeter: each to his own, I'm afraid. When I know what I want I'm much faster typing it than having a pause and then picking. When I don't know what I want I certainly know it, and am perfectly capable of typing Ctrl+Space to get some help.
dwc
On small projects, I have found it to be superb; once I learn how it works I can use the code templates and auto-completion to great advantage. That makes the poor performance in a large project all the more frustrating.
JosephStyons
+7  A: 

Delphi Code Insight invokes the compiler dll to do a custom compile when the user requests Code Insight (Ctrl+Space, '.', etc). This custom compile does a build in the unit and skips over codegen, linking, etc until it reaches your current offset in the file buffer. With this in mind, the unit list that the compiler sees before it gets to your current position will play a large factor in determining the speed of the Code Insight operation. There may be a unit (or multiple units) that are causing a hefty file system dependency, etc. It's quite possible that reordering the units clause, refactoring the units clause to be in multiple files, or removing units in the units clause that aren't necessary for your current unit to compile may improve performance. Additionally, using packages or shortening your unit search path may improve CI response time.

Adam Markowitz
Interesting answer, thank you! Some food for thought there. :-)
robsoft
That is interesting indeed... but I should point out that a FULL BUILD of the application (with our famously fast compiler, yay) takes about 1 minute... and I've had code completion take longer than that.
JosephStyons
If you do a full rebuild (which generates .dcus to disk) does that help CI performance? Also, do you use packages or is it a monolithic .exe?
Adam Markowitz
Monolithic EXE, and a full build does not really seem to help much, no.
JosephStyons
+2  A: 

Be sure to explicitly include all the units(*) used by your project in the dpr.
Do not rely on the search path to find a unit called from another unit, add it to the dpr. The dpr will be much longer but all the compilation related things will be faster, including code-insight.

(*) not the uhits of the installed components.

François
This actually seems to help quite a bit... ctrl+f12 brings up an unsightly list of units that are not specific to the project... but I can live with that.
JosephStyons
+4  A: 

I don't know which version you are using, but much faster code completion is one of the things I like most about Delphi 2009.

Wouter van Nifterick
That's good to know. I'm currently on d2007
JosephStyons
A: 

I think Castalia will help solve your problem.

http://www.twodesk.com/castalia

Give it a try.

Yogi Yang 007
I've tried Castalia before, and it has many nice features, but improving the intellisense performance is not one of them, in my experience.
JosephStyons
A: 

Do you include the sources directories for your teams custom components to be in the library path? It would be interesting to see the speed difference if only the component DCU files are in the library path, versus having the source files there too.

mjustin
Yes, the source paths for the custom components are there. I'll give the dcu-only approach a try
JosephStyons
I tried just the DCU paths, and it did not seem to change the performance of intellisense.
JosephStyons
A: 

I just came across this problem myself, I fixed it by removing a dead network link from my environment library path. Solved my issue 100%.