Differential analysis is an emerging solution for static analysis tools. It is a relatively recent solution, but it’s important to understand what it is, how it works and why you should care.
What’s Differential Analysis?
Put simply, differential analysis is a form of “fast feedback” static code analysis. By using system context data from previous analysis builds, the static analyzer examines only the files that are new or that have changed. This enables the static code analyzer to provide you with analysis results as if your entire system had been analyzed — meaning differential analysis provides you with the shortest possible analysis times while maintaining the accuracy and detail of your analysis data.
Differential vs. Incremental Analysis
Differential analysis is an improvement upon the more traditional incremental analysis, as it requires no prior analysis build of the software on your workstation. This is also what makes differential analysis ideal for DevOps processes — like CI/CD pipelines.
The Importance of Differential Analysis
Differential analysis shortens analysis times and provides you with faster feedback, which is incredibly beneficial. Especially if you need to comply with some kind of coding standard, which often involves running a local or pre-commit analysis of your code. In general, this involves running an analysis on the entire codebase to identify any new issues. While this works well for smaller projects with smaller codebases, problems – such as extended analysis times – can arise when working with a larger codebases. However, with differential analysis, you analyze only the changed files, significantly reducing the amount of time the analysis takes.
How Differential Analysis Works
Without getting overly technical, here is how differential analysis works.
1. The static code analysis tool connects to a server project.
2. You run an integration analysis.
3. You run an analysis of the changed code.
To read more, please visit: https://www.perforce.com/blog/kw/what-is-differential-analysis