Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-6340

Improve Groovy performance

    XMLWordPrintableJSON

    Details

    • Estimated Complexity:
      Unknown

      Description

      We noticed some performance issues with the execution of Groovy expression. In the GroovyExpression the script is parsed 2 times at each evaluation. You'll find attached a patch that caches the parsed-version of the scripts.

      We did some performance tests with the following definition:

      from("direct:start")
          .loop(10000)
          .setBody(new GroovyExpression("request.body + request.getHeader('CamelLoopIndex')"))
          .to("mock:ignore");
      

      We took the average of 5 executions (without the first one):

      use case duration
      default, no cache 52690ms
      patched, with cache 1017ms

      It's more than 50 times faster which is always nice to have

        Attachments

        1. groovy_performance.patch
          5 kB
          Antoine DESSAIGNE

          Issue Links

            Activity

              People

              • Assignee:
                davsclaus Claus Ibsen
                Reporter:
                antoine.dessaigne Antoine DESSAIGNE
              • Votes:
                1 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: