#600 Checkstyle on Enterprise Code and Multi-Core Processors

J.C. Hamlin

The performance of Checkstyle on our project is not acceptable. It raises the build time in Eclipse from 9 minutes to over 20 minutes when it is turned on.

Windows 7 Enterprise 64-bit
Java 1.6.0_31 64-bit
MyEclipse 9.1 64-bit (based on Eclipse 3.6)
Checkstyle Plugin version
Workstation: 12GB RAM, W3680 processor (12 cores at 3.33GHz)

We have about 30 projects, 29 smaller ones which Checkstyle runs on quickly, but the largest is 984 packages, 9526 source files, 11,753 classes, 1,634,770 lines of code and uses 180 third-party jar files and it takes Checkstyle about 10 minutes to analyze that project. During the time Checkstyle is analyzing it the CPU utilization is around 8-10% so Checkstyle is using only one core of twelve cores.

When Checkstyle is enabled, it will build in sequence, and add over 10 minutes to the total build time in Eclipse (changing it from 9 minutes to over 20 minutes).

While it was analyzing the big project, it was using only 1/12th of the available horsepower (1 of 12 cores) of the workstation it was running on. When multiple-cores are available, Checkstyle needs to make use of multiple cores in order to reduce the time it takes to analyze large projects. We want Checkstyle on for all builds, and it should use all 12 cores available to it to reduce the analysis time.

Also requested in the Checkstyle plugin: see: https://sourceforge.net/tracker/?func=detail&aid=3528856&group_id=80344&atid=559497


  • Stephen

    Stephen - 2012-07-16

    I've created a patch for this.
    I'm not very happy with the patch because it uses a static ThreadLocal for the LocalizedMessages, but the alternative of passing in the LocalizedMessages to all the methods which needed it was very invasive. I'll leave the decision of changing the method signatures to the maintainer of this project.
    I don't see how to attach a file. I'll poke around. Otherwise I'll post a link where the patch can be downloaded.

  • Stephen

    Stephen - 2012-07-16

    I'm unable to attach a file.
    The patch can be downloaded here: https://dl.dropbox.com/u/45460700/3528859.diff
    It's a patch to Checkstyle 5.5 release.

  • Stephen

    Stephen - 2012-07-16

    Meh. I spoke too soon. Don't use this patch (yet). I found another concurrency bug.

  • Stephen

    Stephen - 2012-07-16

    This has all kinds of fun ripple effects when implemented. :(

  • Oliver Burn

    Oliver Burn - 2012-07-16

    I am not surprised. I looked into changing Checkstyle to use multiple cores, and concluded that it was to hard. The biggest issue is dealing with Checks that need to parse all files, such as http://checkstyle.sourceforge.net/config_duplicates.html#StrictDuplicateCode.

    Currently, Checks are not designed to be multi-threaded, and having separate instances would not work either.

  • Ivan Sopov

    Ivan Sopov - 2013-11-17

    Since author of the code warned us against using this code and it is not finished (no proper exception handling, parameterization, etc.) I'm closing this issue. Surely we will work on checkstyle performance in future.

  • Ivan Sopov

    Ivan Sopov - 2013-11-17
    • status: open --> closed
    • Group: --> Future
  • Roman Ivanov

    Roman Ivanov - 2015-02-03

    StrictDuplicateCode and any other multi-file Checks were deprecated. Checkstyle is focused in single file validation.

    Multi-threading now become possible, all other progress will be seen on github.

    Last edit: Roman Ivanov 2015-02-03

Log in to post a comment.