Speeding Up Program Features

This section contains recommendations for speeding up different aspects of Source Insight.

Speeding Up Syntax Formatting

Source Insight has many interesting and useful display features for formatting source code. Some of those features require a significant amount of processing.

The display code has been sped up considerably to be able to provide more features with acceptable perfor­mance. It is possible to reduce the display functionality to speed it up.

The Preferences: Syntax Formatting dialog box lets you specify how detailed you want the display. Each option has a performance cost. The significant options are listed here, starting with the least costly, to the slowest and most costly:

1.Apply styles for references to members

2.Apply styles for symbol declarations

3.Apply styles for local symbol declarations

4.Apply styles for references to function-local symbols

5.Apply styles for non-function-local symbols

6.Find references using the Project Symbol Path

7.Qualify member references

Formatting "references" is slower than "declarations".

In general, identifying "references" is slower than "declarations". Identifying references to symbols can be slower if the project is very large, because each reference has to be resolved with a symbol lookup.

The symbol lookup engine has been heavily optimized to allow formatting references to symbols at "display speed". A lot of information is cached in the process, so you may notice that the first time you open a file and start scrolling around in it, it may slow down sometimes. Subsequent viewing of the file will speed up.

Some people want the fastest possible display. However, you may be willing to sacrifice a little of that speed in turn for more useful information that increases productivity.

Speeding Up Typing in Browse Dialog Boxes

Typing and filtering symbol lists can become slow if you have a large project, and you have the Project Set­tings: Quick browsing for symbol name fragments turned on. Source Insight is trying to perform name frag­ment matching on a large name fragment index.

You can address this two different ways. Either you can turn off name fragment indexing in the Project Set­tings dialog box, or you can change the behavior of the list filtering with the Preferences: Typing dialog box.

The Project Settings options control what is stored and indexed in the symbol database.

The Preferences: Typing options control how the information is used in the lists. You do need the name frag­ment information in the database to use the symbol name fragment matching features of the lists. (But, not for file name lists.)

If memory permits, leave Project Settings: Quick browsing for symbol name fragments enabled, and turn off Preferences: Typing: Match name fragments while typing. Even with name fragment matching while typing disabled, you can still use it by prefixing what you type with a space. That is, prefixing what you type with a space toggles the name fragment matching on and off.

If you encounter a lot of disk thrashing while trying to match any name fragments in lists, then your project may be just too big for the available memory.

In Preferences: Typing, turning off both "Match name fragments" and "Match members" will speed it up more and return list filtering to version 2.1 functionality.

Speeding Up Building and Synchronizing Projects

A very large project will take a while to build or rebuild. To speed it up, you can try the following:

Speeding Up Relation Windows

The Relation Window shows relationships between symbols. It works like the Context Window in that it works in the background and automatically shows information about what is selected. For example, if you select a function call, it can show you the call tree starting at that function.

The Relation Window can require a lot of processing. Some relationships are slower to compute. The rela­tionships fall into three categories, listed here from fastest to slowest:

It Takes More Work to Show References

For very large projects, the "References" relationship will be by far the slowest to compute. The performance seems very acceptable on a Pentium II machine with a moderate sized project (about 200,000 lines of code).

Limiting the relations to non-reference type relations will speed the Relation Window up.

It also works well to lock the Relation Window. To lock the Relation Window, click on the lock button in the Relation Window toolbar. You can refresh the Relation Window at any time by using the Refresh Relation Win­dow command, or by clicking on the Refresh button in the Relation Window toolbar.

Speeding Up Auto-Completion

As you type an identifier, the auto-completion window pops up to propose matching identifier names. Every time you type a character, Source Insight considers the symbol data for that file to be "stale". To give you the most accurate auto-completion results, Source Insight would need to reparse your file after each character you type. There is an option that controls this in the Preferences: Symbol Lookups dialog box.

The Parse locally before lookup option causes Source Insight to reparse before the auto-completion window appears. On a fast machine, or in a small file, the speed will be acceptable. However, turning this option off will result in a faster response.

Speeding Up Searching Files

Use Lookup References instead of Search Files.

There are several ways to search across multiple files in Source Insight. The commands: Search Files, Lookup References, and Search Project all perform multi-file searches.

The fastest type of search in Source Insight is the Lookup References search. When you search this way, Source Insight looks for references to a single whole-word item. When you search for a single whole-word, Source Insight uses a special index file to make the search fast. It's a good idea to get into the habit of using Lookup References, instead of Search Files, when you can.

Speeding Up Lookup References

The Lookup References command has a few options that affect its speed.

The Smart Reference Matching option means that the search is scope and context-sensitive; the search results will only contain matches for references to the exact symbol you specify, using the surrounding con­text. This option slows the process down because each same-string occurrence has to be qualified with a symbol lookup, which requires some parsing on the fly. If you turn this off, it will work like the Search Files command; that is, it will search for the string across all the project files.

The Skip Comments and Search Only Comments options also slow the search down a little, but not as much as the smart reference matching option.