Compiled script runs slower than script.

General Macro Scheduler discussion

Moderators: Dorian (MJT support), JRL

Post Reply
User avatar
stitch22
Junior Coder
Posts: 31
Joined: Mon Oct 20, 2008 3:18 pm
Location: California
Contact:

Compiled script runs slower than script.

Post by stitch22 » Fri Jan 25, 2013 5:38 pm

I have a situation where the script prior to compile runs faster "10x" than the compiled version. Never ran into this before.
Makes it kind of difficult to debug. The routine is dawing an image in the dialog box.

Anyone ever experience this?

User avatar
stitch22
Junior Coder
Posts: 31
Joined: Mon Oct 20, 2008 3:18 pm
Location: California
Contact:

Post by stitch22 » Sun Jan 27, 2013 7:03 pm

Resolved the problem. Although I don't know why this effects the the exe file. When compiling the script I have to leave logging enabled. If I disable logging it slows the the exe.
I tested on on previuosly working exe files and the problem occurs when logging is disabled.

Does this make sense? not to me.
Can anyone shed some light on this?

User avatar
JRL
Automation Wizard
Posts: 3497
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Mon Jan 28, 2013 5:38 am

The following script doesn't do much. It just cycles and reports the time per cycle. I do notice differences depending on how I run it. I'm in the .9s if I run from the editor and in the .7s if I run from the main menu. I'm in the .6s if I run compiled. Made many different compile option choices but did not see that any choice combination made any difference.

Perhaps you could alter this script to demonstrate where you are seeing differences based on compile options.

Code: Select all

Dialog>Dialog1
object Dialog1: TForm
  Position = poScreenCenter
  Caption = 'Speed Test'
  ClientHeight = 158
  ClientWidth = 178
  object Label1: TLabel
    Left = 26
    Top = 16
    Width = 32
    Height = 13
    Caption = 'Current Cycle Time'
  end
  object Label2: TLabel
    Left = 26
    Top = 80
    Width = 32
    Height = 13
    Caption = 'Best Cycle Time'
  end
  object Panel1: TPanel
    Left = 26
    Top = 38
    Width = 127
    Height = 27
    TabOrder = 0
  end
  object Panel2: TPanel
    Left = 26
    Top = 106
    Width = 127
    Height = 31
    TabOrder = 1
  end
end
EndDialog>Dialog1

AddDialogHandler>Dialog1,,OnClose,Quit
Let>BestTime=10000
Show>Dialog1
Label>Start
Timer>StartTime
Let>kk=0
Repeat>kk
  Add>kk,1
Until>kk=10000
  Timer>EndTime
  Let>CycleTime={(%EndTime%-%StartTime%)/1000}
  SetDialogProperty>Dialog1,Panel1,Caption,CycleTime
  If>%BestTime%>%CycleTime%
  Let>BestTime=CycleTime
    SetDialogProperty>Dialog1,Panel2,Caption,BestTime
  EndIf
Goto>Start

SRT>Quit
  Exit>0
END>Quit

User avatar
stitch22
Junior Coder
Posts: 31
Joined: Mon Oct 20, 2008 3:18 pm
Location: California
Contact:

Post by stitch22 » Tue Jan 29, 2013 3:11 am

Hi JRL,

I had forgoten about the timer function, thanks for the reminder.
After a few hours testing I found that the problem does not occur when data is generated with in the script.

when I create array of data points using MS array functions it works quite well. The results are similar to what you experienced.

However I believe ( not proven but further testing required) when I use Vbscript to read a file into a multidemensional array and then use VBEval calls to retrieve the array variables the problem occurs.

As I was able to compile and run one of the old test files. The one we used for the rotation problem you helped me with.
It works just fine. In that file all the data was created within MS.

I can not post the entire script. When I get a working example that I can post I will.

Thanks

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts