Factors That Affect Performance

Source Insight was designed to push some of the limits of functionality for a programming editor. As such, it has features that can stress a system that is too slow or not optimized for it. This section describes factors that you can control which affect Source Insight's performance.

Project Size

The size of a project has a large effect on the performance of certain features in Source Insight. The project size can be measured in number of files, and in number of declared symbols.

Use Project Report to see project size statistics.

To find out how large your project is, use the Project > Project Report command and note the top lines of the report. At the top of the project report, Source Insight prints the number of files, the number of symbols, and the number of symbol index entries in the project. You can also see these same statistics in the Project > Rebuild Project dialog box at the bottom of the dialog box. (You do not have to rebuild the project to see the statistics.)

Project Index Settings

The Project Settings dialog box contains options for indexing your project. If you enable all the indexing options, and your project is large, you may hurt performance.

The symptoms of too large an index are:

Name Fragment indexing a large project can be slow and memory intensive

If you have a large project (over 500,000 symbols) you should try turning off the symbol name fragment indexing. You can find out how large the database is by selecting Project > Rebuild Project and looking at the statistics on the bottom of the dialog box. Just cancel this dialog box when you are done. If the number of index entries is over 1 million, then things can start to slow down. Adding more memory to your machine will improve performance.

To remove the name fragment indexing, run the Project > Project Settings command and turn off Quick browsing for symbol name fragments. Then use the Rebuild Project command to recreate your project from scratch.

Memory Usage

Source Insight very efficient in its memory use. However, Source Insight uses virtual memory in proportion to the size of your project. If your projects are large, Source Insight will require more virtual memory. Large proj­ects can use a lot of virtual memory.

Source Insight makes heavy use of memory-mapped files. This is a operating system feature whereby files can be mapped into virtual address space, so that a file looks like a block of memory to a program. Source Insight uses memory-mapped files to provide the fastest possible access to source files and database files.

Source Insight uses an efficient way of mapping large project databases and indexes into virtual memory.

The size of a project database is proportional to the number of declared symbols in the project. Therefore, if your project is very large, the amount of memory used by Source Insight as reported by Task Manager (the Working Set) can be several hundred megabytes. However, most of the memory represents portions of the symbol database mapped into virtual memory space. Source Insight does not require this much physical memory.

Custom Parsing Expressions

You can augment a language with your own custom parsing regular expressions. You can edit these expres­sions by right clicking on a source file and selecting Language Properties.

Be careful with the custom parsing expressions you define. If you have too many expressions, or you are using a regular expression that is inherently slow to match, you may notice that it takes a moment or two to parse your files.

A regular expression can be slow to match if it starts with a pattern that is easily matched, but ends with a pattern that often does not match. For example:

[a-z]*(\([a-z]+\))

This expression will be slow to match because the pattern starts with [a-z]*, which means, "match any zero or more alphabetic characters". Most characters in a file will potentially match, cause the pattern matcher to try and fail to match many times.

Location of Files on a Network

While it is possible to add source files to your project from a remote network drive, that can cause Source Insight to slow down because access to network drives is slower in general.

In addition, locating the project data folder on a network drive can also result is poor performance. We rec­ommend locating the Project Data Directory on your local, non-networked drive.

Location of the "Documents" Folder

In Windows, the "Documents" folder is a virtual folder that can exist either locally, or on a remote network drive. Since Source Insight stores per-user data inside that folder, some operations can become slow if you locate this folder on a remote drive. In particular, if you used the Import External Symbols feature, the result­ing import project symbols are stored in the Documents\Source Insight 4.0\Projects folder. Therefore auto-completion while typing can become slow.

If possible, locate your "Documents" folder on your local drive. If you cannot do that, then you can set a reg­istry entry to force Source Insight to use a local drive for the per-user data folder.

In regedit.exe, find the key:

HKEY_CURRENT_USER\Software\Source Dynamics\Source Insight\4.0\Paths

Add a new string value named "UserDataDir". Set the string value to the full path of the folder you want to user for per-user data.