Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delphi code completion performance [closed]

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.

like image 871
JosephStyons Avatar asked May 22 '09 15:05

JosephStyons


4 Answers

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.

like image 71
Adam Markowitz Avatar answered Nov 12 '22 02:11

Adam Markowitz


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 units of the installed components.

like image 22
Francesca Avatar answered Nov 12 '22 01:11

Francesca


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.

like image 4
Wouter van Nifterick Avatar answered Nov 12 '22 00:11

Wouter van Nifterick


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.

like image 3
dwc Avatar answered Nov 12 '22 00:11

dwc