Delphi code completion performance

JosephStyons picture JosephStyons · May 22, 2009 · Viewed 10.2k times · Source

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.

Answer

Adam Markowitz picture Adam Markowitz · May 22, 2009

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 uses clause, refactoring the uses clause to be in multiple files, or removing units in the uses 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.