Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-5314

DefaultModelValidator misuses String.matches

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.0.4
    • 3.1.0-alpha-1
    • Bootstrap & Build
    • None
    • Patch

    Description

      While investigating MNG-5312, a profiler run turned up tens of thousands of calls to DefaultModelValidator.validateId consuming a considerable portion of total CPU time. Turns out the existing code uses String.matches, which recompiles the regex on each call, which is far more expensive than applying a precompiled pattern. A trivial fix makes this method disappear from the hot spots shown by the profiler, though the fix of MNG-5312 of course means that there would be far fewer calls to this method to begin with.

      Attachments

        1. DefaultModelValidator.diff
          1 kB
          Jesse N. Glick

        Issue Links

          Activity

            People

              jvanzyl Jason van Zyl
              jglick Jesse N. Glick
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: