0 Replies Latest reply: Oct 8, 2012 9:20 AM by Baptiste MARCHAND RSS

    VBScript FunctionCalls VS QlikView CallSub

      I've found a great difference between vbscript loop execution and script loop execution.

      And ...

      The fastest is not what i thougth !


      Let's try :


      In the module part , create a function doing an interation and some work:

      In the loadscript : have a log function , have a QlikView Script loop sub, disable writing to the log

      Call the vbScript loop Function

      Call the QlikView Script loop Function


      rem Module Function

      function fBoucle ( vIndice, vDebut, vFin, vPas )

      vNbCellules = Clng (( vFin-vDebut)/vPas)

      execute "dim vTmpArray ( " & vNbCellules & ")"


          for vIndice = vDebut To vFin step vPas

              vTmpArray( ( vIndice - vDebut ) / vPas ) = vIndice





      end function





      sub trace_temps(Message )

      let vTemps=Date( Now(),'YYYYMMDD hh:mm:ss');

          trace $(vTemps) : $(Message);

      end sub


      //QlikView Loop Sub

      sub ssBoucle ( vIndice, vDebut, vFin, vPas )

      let az=0;

          for vIndice = vDebut To vFin step vPas

              az= vIndice;


      end sub;


      //About 2 second for 10000000 iterations

      call trace_temps('Debut fBoucle' );

      let tmp= fBoucle ( 0, 1, 100000, 1);

      trace $(tmp);

      call trace_temps('Fin fBoucle' );


      //About 4 second for 25000 iterations

      call trace_temps('Debut ssBoucle' );

      call ssBoucle ( 0, 1, 25000, 1);

      call trace_temps('Fin ssBoucle' );



      When the work is different, and we can't do the same, it's sound to me that calling vbscript function is not so bad