Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-42221

MSBuild parser takes unreasonable amount of time

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • warnings-plugin
    • None
    • warnings plugin 4.59

      Parsing a log with the MSBuild parser takes over 10 minutes in severe cases, whereas the GCC parser takes at most 10 seconds on a similar log. I'll admit that the log is rather large (17 Mb), but the performance between GCC and MSBuild differs by a factor of 60.

      This log is the result of a Pipeline build which makes 14 parallel sub-builds on different compilers and platforms, and one possibility to lessen the severity of this issue would be to be able to run the parser on just the current "node" or "stage" statement in the Pipeline script. This would prevent the MSBuild parser from having to see the gazillion of lines coming from GCC, which it won't recognize anyway.

          [JENKINS-42221] MSBuild parser takes unreasonable amount of time

          Ulli Hafner added a comment -

          After fixing several issues the MS build parser regular expression seems to be overly complex now. I think this is the problem.

          You can try to pipe the output of the compile steps into files and use the parser only on the corresponding files too speed up things...

          Ulli Hafner added a comment - After fixing several issues the MS build parser regular expression seems to be overly complex now. I think this is the problem. You can try to pipe the output of the compile steps into files and use the parser only on the corresponding files too speed up things...

          Emil Styrke added a comment -

          Thanks for the reply!

          I did some benchmarking on the regex, and I found out that adding a beginning-of-line anchor to the first "or" group cuts the running time from 16 seconds to 0.15 seconds in my testcase. I created a PR for the change at https://github.com/jenkinsci/warnings-plugin/pull/86.

          Emil Styrke added a comment - Thanks for the reply! I did some benchmarking on the regex, and I found out that adding a beginning-of-line anchor to the first "or" group cuts the running time from 16 seconds to 0.15 seconds in my testcase. I created a PR for the change at https://github.com/jenkinsci/warnings-plugin/pull/86 .

          Code changed in jenkins
          User: Emil Styrke
          Path:
          src/main/java/hudson/plugins/warnings/parser/MsBuildParser.java
          http://jenkins-ci.org/commit/warnings-plugin/3bd036172840f914b75ff831c85a8f126225dc0d
          Log:
          Add anchor to improve performance

          Should fix JENKINS-42221.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Emil Styrke Path: src/main/java/hudson/plugins/warnings/parser/MsBuildParser.java http://jenkins-ci.org/commit/warnings-plugin/3bd036172840f914b75ff831c85a8f126225dc0d Log: Add anchor to improve performance Should fix JENKINS-42221 .

          Code changed in jenkins
          User: Ulli Hafner
          Path:
          src/main/java/hudson/plugins/warnings/parser/MsBuildParser.java
          http://jenkins-ci.org/commit/warnings-plugin/ad9f3c917876abbb08763a6b041934a6e6b404f4
          Log:
          [FIXED JENKINS-42221] Merge pull request #86 from estyrke/patch-1

          Added anchor to improve performance of regular expression of MS Build parser.

          Compare: https://github.com/jenkinsci/warnings-plugin/compare/b49d2b85a32f...ad9f3c917876

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Ulli Hafner Path: src/main/java/hudson/plugins/warnings/parser/MsBuildParser.java http://jenkins-ci.org/commit/warnings-plugin/ad9f3c917876abbb08763a6b041934a6e6b404f4 Log: [FIXED JENKINS-42221] Merge pull request #86 from estyrke/patch-1 Added anchor to improve performance of regular expression of MS Build parser. Compare: https://github.com/jenkinsci/warnings-plugin/compare/b49d2b85a32f...ad9f3c917876

            drulli Ulli Hafner
            estyrke Emil Styrke
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: