Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-31322

Calling sub-javascript chain is extremely costly

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2023.0
    • Component/s: Automation
    • Release Notes Summary:
      Calling an Automation script from another script is faster
    • Tags:
    • Sprint:
      nxplatform #78, nxplatform #79
    • Story Points:
      2

      Description

      (test done with Nuxeo 2021.27.13, tomcat, Mac OS, embedded H2 and es - but we don't test data here anyways)

      Say you have these simple JS automation:

      // Test_AllIncluded
      function run(input, params) {
       var tot = 0;
        for( var i = 0; i < 10000; i++) {
          tot += i;
        }
      }
      

      Similar, but calling a sub chain (not exactly the same, we don't sum the values, but it's OK for the test):

      // With subchain
      function run(input, params) {
       var tot = 0;
        for( var i = 0; i < 10000; i++) {
          javascript.theSubChain(input, {});
        }
      }
      

      The other chain:

      // With javascript.theSubChain
      function run(input, params) {
       var tot = 1;
      }
      

      The first one, when ran takes some dozens milliseconds (21). The second one takes seconds, literally dozens of seconds (45,000). This is a non DEV env, running the tomcat package on my Mac, but at this level of difference (like about thousands times slower), I believe the CPU, load and all is not an issue.

      So, basically, a JS automation calling a JS automation takes way way too much time.

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: