Main Content

Use fast analysis mode for Bug Finder (-fast-analysis)

Run analysis using faster local mode

Description

This option affects a Bug Finder analysis only.

Run analysis using faster local mode. The first run analyzes all files, but subsequent runs reanalyze only the files that you edited since the previous analysis.

Fast analysis mode is a faster way to analyze code for localized defects and coding standard violations. When you launch fast analysis, Bug Finder analyzes your code for a subset of defects and coding rules alongside code metrics. These defects and coding standard violations are ones that can be found in the early stages of the analysis or can leverage archived information from a previous analysis. The analysis results are also comparatively easier to review and fix because most results can be understood by focusing on two or three lines of code (the line with the defect and one or two previous events).

Because of the simplified nature of the analysis, you might see significantly fewer defects in the fast analysis mode compared to a regular Bug Finder analysis.

Set Option

User interface (desktop products only): In your project configuration, the option is on the Run Settings node.

User interface (Polyspace Platform, desktop products only): In your project configuration, in the Static Analysis tab, click Defects and Coding Standards and then select Use fast analysis mode for Bug Finder.

Command line and options file: Use the option -fast-analysis. See Command-Line Information.

Why Use This Option

If you use this option, you have to wait less for analysis results from your second analysis onwards. During development, you can frequently run analysis in fast mode and quickly fix new defects or coding standard violations.

Polyspace® produces results quickly because the analysis is localized. When you rerun in fast-analysis mode, Polyspace reanalyzes only those files that need to be reanalyzed, regenerating results even more quickly. These situations trigger a reanalysis.

SituationWhat Is Reanalyzed
You modified a source file.Modified source file
You modified a header file.Source files that include the modified header file (directly or indirectly)
You added or removed an analysis option.All files

Previous fast-analysis results were not found.

For instance, you deleted the results folder.

All files
You upgraded to a later release of Polyspace and ran the analysis.

All files

Comments from the previous analysis are retained and imported to the current analysis.

For example, consider a Polyspace project with three .c files and you fix a bug in one of the files. When you rerun the analysis, Polyspace reanalyzes only the one file that you changed.

The results of fast analysis appear in a folder separate from the results of normal analysis.

Settings

Default: Off

On

Polyspace Bug Finder™ runs in fast-analysis mode. Polyspace analyzes code for only a subset of defects and coding standard violations and calculates code metrics if enabled. If you have enabled checking of defects or coding standard violations that are not supported by fast-analysis, your code is not checked for those results.

Off

Polyspace Bug Finder runs in the normal mode. Analysis checks for all selected defects and coding standard violations.

Tips

Comments Import

If you enter comments in your results, the comments are automatically imported to the next analysis in fast mode.

To import the comments from fast mode results to results of a regular Bug Finder analysis, do one of the following:

  • Select Tools > Import Comments. Navigate to the sibling results folder BF_Fast_Result and import comments from the fast mode results.

  • When reviewing results of fast mode, enter the comments directly into your code. If you run a regular analysis on this code, the comments are imported to your analysis results.

    For details on how to enter code comments, see Annotate Code and Hide Known or Acceptable Results.

Fast Analysis Limitations

In fast analysis mode:

  • You cannot create a new results folder for each run. Each run overwrites the results of the previous run.

  • You cannot run the analysis on a remote cluster.

Command-Line Information

Parameter: -fast-analysis
Default: Off
Example (Bug Finder): polyspace-bug-finder -sources filename -fast-analysis
Example (Bug Finder Server): polyspace-bug-finder-server -sources filename -fast-analysis