How is the new Dialyzer `--incremental` mode different?

From Release OTP 26.0-rc1 · erlang/otp · GitHub

Dialyzer has a new incremental mode that be invoked by
giving the --incremental option when running Dialyzer.
This new incremental mode is likely to become the
default in a future release.

The docs in the source code say:

–incremental
The analysis starts from an existing incremental PLT, or builds one from
scratch if one doesn’t exist, and runs the minimal amount of additional
analysis to report all issues in the given set of apps. Notably, incremental
PLT files are not compatible with "classic" PLT files, and vice versa.
The initial incremental PLT will be updated unless an alternative output
incremental PLT is given.

How is this different from the current strategy? Dialyzer is currently very slow on the first run and much faster after PLT files exist, so in that sense it’s already “incremental” (not starting from the beginning every time).

2 Likes

Incremental Dialyzer: How we made Dialyzer 7x Faster | Thomas Davies | Code BEAM America 2023 goes into the details. Since the presentation was made before 26.0-rc1 maybe something changed :thinking: but it explains the concepts very well

3 Likes

Neat, thanks @fizfaz!

My takeaways:

  • Main change: PLTs (with a new iplt format) now include the actual warnings from the previous run
  • They did some work to make compilation more deterministic (eg don’t include absolute file paths). (Do we still need to use the +deterministic compiler option that Thomas mentioned?)
  • PLTs now store info about your actual code, not just your “static context” (dependencies, stdlib, etc)
  • Hashes of BEAM files now depend only on the parts that can affect analysis
  • Now a small change in application code generally creates a small analysis workload - depends on “the size of the change, plus the transitive closure of code that depends on it” - meaning, if A depends on the changed code, and B depends on A, all of them have to be re-analyzed
6 Likes