code: private boolean creatingFunctionShortensGremlin(GroovyExpression headExpr) {
          int tailLength = getTailLength();
          int length = headExpr.toString().length() - tailLength;
  
          int overhead = 0;
          if (nextFunctionBodyStart instanceof AbstractFunctionExpression) {
              overhead = functionDefLength;
          } else {
              overhead = INITIAL_FUNCTION_DEF_LENGTH;
          }
          overhead += FUNCTION_CALL_OVERHEAD * scaleFactor;
          //length * scaleFactor = space taken by having the expression be inlined [scaleFactor] times
          //overhead + length = space taken by the function definition and its calls
          return length * scaleFactor > overhead + length;
      }
docs: the overall length of the Groovy script.