LB Booster
« LBB runs 7 times slower than LB on my GBRL-Sender »

Welcome Guest. Please Login or Register.
Apr 1st, 2018, 03:26am



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
We apologize Conforums does not have any export functions to migrate data.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

Thank you Conforums members.
Speed up Liberty BASIC programs by up to ten times!
Compile Liberty BASIC programs to compact, standalone executables!
Overcome many of Liberty BASIC's bugs and limitations!
LB Booster Resources
LB Booster documentation
LB Booster Home Page
LB Booster technical Wiki
Just BASIC forum
BBC BASIC Home Page
Liberty BASIC forum (the original)

« Previous Topic | Next Topic »
Pages: 1 2 3 4 5  Notify Send Topic Print
 locked  Author  Topic: LBB runs 7 times slower than LB on my GBRL-Sender  (Read 1556 times)
tsh73
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 210
xx Re: LBB runs 7 times slower than LB on my GBRL-Sen
« Reply #45 on: Dec 26th, 2017, 7:55pm »

I'm not too sure what 'TIC' stands for
too
but if you just print elapsedtime
you'll see it 15-16 ms. Sometimes 31-32

Interesting then I set
bucketdelay=10
I got elapsedtime 15-16 ms, never 31-32.
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: LBB runs 7 times slower than LB on my GBRL-Sen
« Reply #46 on: Dec 26th, 2017, 8:06pm »

on Dec 26th, 2017, 7:55pm, tsh73 wrote:
I set bucketdelay=10 I got elapsedtime 15-16 ms, never 31-32.

That's exactly what you would expect, isn't it? With bucketdelay=15 it's close to the minimum timer period (about 16 ms usually) so sometimes you get 16 and sometimes it creeps over the threshold and you get 32. When bucketdelay=10 it's well below the minimum, so you get 16 ms consistently.

I would expect that if you set bucketdelay=20 you will get 32 ms consistently.

Richard.
User IP Logged

tsh73
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 210
xx Re: LBB runs 7 times slower than LB on my GBRL-Sen
« Reply #47 on: Dec 26th, 2017, 8:14pm »

>>I would expect that if you set bucketdelay=20 you will get 32 ms consistently.
Yes, 31-32
User IP Logged

xtal
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 27
xx Re: LBB runs 7 times slower than LB on my GBRL-Sen
« Reply #48 on: Dec 26th, 2017, 8:52pm »

TIC is my shorthand for clock tic

you know like TICK-TOCK-TICK-TOCK ;D

I have no idea why clicking the print window speeds up , but it does on more than 1 of my machines , maybe W10 build 15063 and 16299 compatability issue , who knows, I guess I'll have to stick with LB and the 8 additional dll files it generates. LBB was generating about 135k where as LB totals close to 2 meg...

Since I tweaked that test code and applied it to main pgm LB consistantly says 15.6 millisec on my main unit [if you are not clicking any thing] which is the one with the largest delay on LBB.
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: LBB runs 7 times slower than LB on my GBRL-Sen
« Reply #49 on: Dec 26th, 2017, 9:18pm »

on Dec 26th, 2017, 8:52pm, xtal wrote:
I have no idea why clicking the print window speeds up , but it does on more than 1 of my machines

By "print window" I presume you mean the 'mainwin' (it helps understanding to use the correct terminology). What's interesting is not so much that clicking on it speeds things up, but that it's slow in the first place!

A possible explanation is that you've installed some non-standard utility on both machines, such as a shell extension or other productivity tool. What do the slow machines have in common that most PCs don't have?

Have you tried disabling your virus scanner? They can be responsible for all sorts of peculiar side-effects.

Quote:
I guess I'll have to stick with LB and the 8 additional dll files it generates. LBB was generating about 135k where as LB totals close to 2 meg...

That's entirely up to you. Other people use LBB to build large commercial applications - I suppose Cabinet Planner is the best known example - and neither they nor their customers seem to be troubled by any similar effect.

Your profiler reports don't show anything 'wrong' as such, only that your program is spending more time in the WAIT statement than expected. So long as the serial input buffer doesn't overflow in that period, does it actually matter very much?

Since it's the WAIT that is affected, have you tried the same trick that is sometimes necessary in LB (for example when used with WMLiberty) which is to replace the WAIT with a SCAN/Sleep loop? Maybe that would make a difference:

Code:
[waitnow]
    scan
    calldll #kernel32, "Sleep", 1 as long, r as void
    goto [waitnow] 

Richard.
« Last Edit: Dec 26th, 2017, 9:32pm by Richard Russell » User IP Logged

Rod
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 110
xx Re: LBB runs 7 times slower than LB on my GBRL-Sen
« Reply #50 on: Dec 27th, 2017, 3:23pm »

I have had time to test and get the same results, the program runs at 16ms on my Win10 machine whether LB or LBB.

User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: LBB runs 7 times slower than LB on my GBRL-Sen
« Reply #51 on: Dec 27th, 2017, 6:02pm »

on Dec 27th, 2017, 3:23pm, Rod wrote:
I have had time to test and get the same results, the program runs at 16ms on my Win10 machine whether LB or LBB.

Thanks. It's pretty clear that the OP's 'problem' is very specific to a couple of his machines rather than being more general. I still think the likely explanation is that some third-party framework is installed that is changing the behavior of standard Windows controls.

If he still wants to use LBB I can think of three possible workarounds:
  1. Replacing the WAIT with a SCAN/Sleep loop, as I suggested before, might help; this is the same fix as is sometimes necessary in LB 4 when used with the WMLiberty DLL. This code, or something similar, can be used instead of the WAIT:

    Code:
    [waitnow]
        scan
        calldll #kernel32, "Sleep", 1 as long, r as void
        goto [waitnow] 

  2. Replacing the 'branch label' TIMER handler with a SUB handler might also be an effective cure (the WAIT is then only executed once!). It's more elegant to use a SUB handler, and it improves program structure, but unfortunately you can't (reliably) do so in LB 4 because of a bug. To implement this fix the TIMER statement must be changed as follows:

    Code:
        timer bucketdelay, ckbuf 

    and the handler changed into a SUB called ckbuf, terminating in END SUB rather than GOTO [LoopExit] of course. It may also require some variables being declared as globals.

  3. It's misleading to describe the issue as LBB 'running slow'. What is actually happening is that when there's nothing for the program to do - so a WAIT is executed - it is taking longer to resume normal execution than expected. The possible throughput of the program isn't actually reduced, but it would mean processing the incoming serial data less frequently but in bigger chunks. If this less frequent processing is acceptable it may not be necessary to make any changes, other than perhaps setting Com to increase the size of the serial buffer.
I will be interested to learn whether the OP finds one of these effective.

Richard.
« Last Edit: Dec 27th, 2017, 6:38pm by Richard Russell » User IP Logged

xtal
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 27
xx Re: LBB runs 7 times slower than LB on my GBRL-Sen
« Reply #52 on: Dec 28th, 2017, 12:25am »

Form part 1
Code:
[WindowSetup]
''NOMAINWIN
WindowWidth = 1020 : WindowHeight = 700 '877
UpperLeftX = INT((DisplayWidth-WindowWidth)/2)
UpperLeftY = INT((DisplayHeight-WindowHeight)/2)
Menu #main, "DROreset", "Reset MPX", [ZX], "Reset MPY", [MZY], "Reset MPZ", [MZZ], "ResetALL", [MZR]
Menu #main, "HELP", "Q/A.txt", [HELPx],"LibertyBasic.chm",[HELPchm],"LB-Forum",[HELPforum]
[ControlSetup]
statictext #main.statictext2, "MPOS", 60, 105, 40, 20
button #main.hle, "Hard Limits",[HLTOGGLE], UL, 100, 103, 60, 20
graphicbox #main.HLimit, 165, 103, 35, 20
statictext #main.statictext3, "WCO", 230, 105, 25, 20
statictext #main.statictext4, "WPOS", 350, 105, 40, 20
button #main.button5, "$RST=$",[RSTdollar], UL, 5, 0, 45, 20
button #main.button6, "$RST=#",[RSTnumber], UL, 5, 25, 45, 20
button #main.button7, "$RST=*",[RSTastric], UL, 5, 50, 45, 20
button #main.button8, "$SLP",[SLP], UL, 5, 75, 45, 20
button #main.buttonx, "$G val", [GGG], UL, 5, 100, 45, 20
button #main.buttony, "$# GC ", [NBR], UL, 5, 125, 45, 20
button #main.button9, " win$ ",[button9], UL, 5, 150, 45, 20
button #main.button10, " WIN$ ",[button10], UL, 5, 175, 45, 20
button #main.button11, " ? ", [STATUS], UL, 5, 200, 45, 20
button #main.Ncode, "$N 1st", [NCMD], UL, 5, 225, 45, 20
button #main.Ccode, "$C chk", [CCMD], UL, 5, 250, 45, 20
button #main.info, "$I Info", [INFO], UL, 5, 275, 45, 20
button #main.help, "$ Help ", [HELP], UL, 5, 300, 45, 20
button #main.ALRReset, "$X ALR", [XCMD], UL, 5, 325, 45, 20
button #main.home, "$H Hm", [HOME], UL, 5, 350, 45, 20
button #main.softReset, "Ctl-X ", [softRest], UL, 5, 375, 45, 20
button #main.params,"$$ Stat", [PARAMS], UL, 5, 400, 45, 20
button #main.Resume, "Resume", [RESUME], UL, 5, 425, 45, 20
button #main.Pause, "Pause", [PAUSE], UL, 5, 450, 45, 20
textbox #main.ManualTx, 5, 475, 470, 20
button #main.Enter,"",[Enter],UL,473,475,5,20
button #main.ManualSend, "SEND COMMANDS", [SEND], UL, 190, 500, 180, 20
button #main.JXplus, "X ++", [JogXP], UL, 5, 495, 55, 20
button #main.JYplus, "Y ++", [JogYP], UL, 65, 495, 55, 20
button #main.JZplus, "Z ++", [JogZP], UL, 125, 495, 55, 20
button #main.JXPa,"+",[JXPa],UL,5,515,12,13
button #main.JXPb,"+",[JXPb],UL,16,515,12,13
button #main.JXPc,"+",[JXPc],UL,27,515,12,13
button #main.JXPd,"+",[JXPd],UL,38,515,12,13
button #main.JXPe,"+",[JXPe],UL,49,515,12,13
stylebits #main.JX, _ES_CENTER,0,0,0
textbox #main.JX, 5, 528, 55, 20
button #main.JXMa,"--",[JXMa],UL,5,549,12,13
button #main.JXMb,"--",[JXMb],UL,16,549,12,13
button #main.JXMc,"--",[JXMc],UL,27,549,12,13
button #main.JXMd,"--",[JXMd],UL,38,549,12,13
button #main.JXMe,"--",[JXMe],UL,49,549,12,13
button #main.JYPa,"+",[JYPa],UL,65,515,12,13
button #main.JYPb,"+",[JYPb],UL,76,515,12,13
button #main.JYPc,"+",[JYPc],UL,87,515,12,13
button #main.JYPd,"+",[JYPd],UL,98,515,12,13
button #main.JYPe,"+",[JYPe],UL,109,515,12,13
stylebits #main.JY, _ES_CENTER,0,0,0
textbox #main.JY, 65, 528, 55, 20
button #main.JYMa,"--",[JYMa],UL,65,549,12,13
button #main.JYMb,"--",[JYMb],UL,76,549,12,13
button #main.JYMc,"--",[JYMc],UL,87,549,12,13
button #main.JYMd,"--",[JYMd],UL,98,549,12,13
button #main.JYMe,"--",[JYMe],UL,109,549,12,13
button #main.JZPa,"+",[JZPa],UL,125,515,12,13
button #main.JZPb,"+",[JZPb],UL,136,515,12,13
button #main.JZPc,"+",[JZPc],UL,147,515,12,13
button #main.JZPd,"+",[JZPd],UL,158,515,12,13
button #main.JZPe,"+",[JZPe],UL,169,515,12,13
stylebits #main.JZ, _ES_CENTER,0,0,0
textbox #main.JZ, 125, 528, 55, 20
button #main.JZMa,"--",[JZMa],UL,125,549,12,13
button #main.JZMb,"--",[JZMb],UL,136,549,12,13
button #main.JZMc,"--",[JZMc],UL,147,549,12,13
button #main.JZMd,"--",[JZMd],UL,158,549,12,13
button #main.JZMe,"--",[JZMe],UL,169,549,12,13
button #main.JXminus, "X ---", [JogXM], UL,5, 563, 55, 20
button #main.JYminus, "Y ---", [JogYM], UL,65, 563, 55, 20
button #main.JZminus, "Z ---", [JogZM], UL,125, 563, 55, 20
button #main.JXFa,"+",[JXFa],UL,5,585,14,13
button #main.JXFb,"+",[JXFb],UL,18,585,14,13
button #main.JXFc,"+",[JXFc],UL,31,585,14,13
button #main.JXFd,"+",[JXFd],UL,44,585,14,13
stylebits #main.JXF, _ES_CENTER,0,0,0
textbox #main.JXF, 5, 600, 55, 22
button #main.JXFe,"--",[JXFe],UL,5,624,14,13
button #main.JXFf,"--",[JXFf],UL,18,624,14,13
button #main.JXFg,"--",[JXFg],UL,31,624,14,13
button #main.JXFh,"--",[JXFh],UL,44,624,14,13
button #main.JYFa,"+",[JYFa],UL,65,585,14,13
button #main.JYFb,"+",[JYFb],UL,78,585,14,13
button #main.JYFc,"+",[JYFc],UL,91,585,14,13
button #main.JYFd,"+",[JYFd],UL,104,585,14,13
stylebits #main.JYF, _ES_CENTER,0,0,0
textbox #main.JYF, 65, 600, 55, 22
button #main.JYFe,"--",[JYFe],UL,65,624,14,13
button #main.JYFf,"--",[JYFf],UL,78,624,14,13
button #main.JYFg,"--",[JYFg],UL,91,624,14,13
button #main.JYFh,"--",[JYFh],UL,104,624,14,13 '
button #main.JZFa,"+",[JZFa],UL,125,585,14,13
button #main.JZFb,"+",[JZFb],UL,138,585,14,13
button #main.JZFc,"+",[JZFc],UL,151,585,14,13
button #main.JZFd,"+",[JZFd],UL,164,585,14,13
stylebits #main.JZF, _ES_CENTER,0,0,0
textbox #main.JZF, 125, 600, 55, 22
button #main.JZFe,"--",[JZFe],UL,125,624,14,13
button #main.JZFf,"--",[JZFf],UL,138,624,14,13
button #main.JZFg,"--",[JZFg],UL,151,624,14,13
button #main.JZFh,"--",[JZFh],UL,164,624,14,13
texteditor #main.WinStatus, 55,125, 420, 80
texteditor #main.GCwindow, 55, 210, 420, 260
''''bmpbutton #main.EMRRESET, BMPdir$;"estop6.bmp",[ESTOP],UL, 188,575    '*********
button #main.M5, "M3", [M3], UL, 290, 580, 30, 20
button #main.M5, "M5", [M5], UL, 290, 605, 30, 20
button #main.Connect, "CONNECT", [CONNECT], UL, 375, 500, 60, 20
button #main.Connect, "Scan", [ScanPorts], UL, 440, 500, 35, 20
combobox #main.CommPort, port$(), [portclick], 375, 525, 60, 20
combobox #main.Baudrate, baud$(), [BaudSel], 375, 550, 60, 20
button #main.Disconnect, "HANG UP", [DISCONNECT], UL, 375, 575, 60, 20
stylebits #main.Mag1, _ES_CENTER,0,0,0
textbox #main.Mag1, 435, 575, 40, 20
button #main.rtz, "RTNZERO", [Ret2ZERO], UL, 375, 600, 60, 30
button #main.magnify, "MAG",[MAGNIFY],UL,435,600,40,30
stylebits #main.PLOTa, _ES_CENTER,0,0,0
textbox #main.PLOTa, 435, 525, 40, 20
button #main.plotting, "PLOT",[PLOTXY],UL,435,550,40,20
graphicbox #main.Status, 188, 522, 180, 50
TextboxColor$ = "yellow"
textbox #main.Comx, 320,580,50,20
textbox #main.Baud, 320,605,50,20
TextboxColor$ = "white"
button #main.park, "Park", [PARK], UL, 445, 0, 40, 20
button #main.mac1, "Mac1", [mac1], UL, 485, 0, 40, 20
button #main.mac2, "Mac2", [mac2], UL, 525, 0, 40, 20
button #main.mac3, "Mac3", [mac3], UL, 565, 0, 40, 20
button #main.mac4, "Mac4", [mac4], UL, 605, 0, 40, 20
button #main.mac5, "Mac5", [mac5], UL, 645, 0, 40, 20
button #main.mac6, "Mac6", [mac6], UL, 687, 0, 40, 20
button #main.mac7, "Mac7", [mac7], UL, 728, 0, 40, 20
button #main.mac8, "Mac8", [mac8], UL, 773, 0, 40, 20
button #main.mac9, "Mac9", [mac9], UL, 818, 0, 40, 20
button #main.X1,"ScrT1",[SCRa],UL, 860,0,40,20
button #main.X2,"ScrT2",[SCRb],UL, 900,0,40,20
button #main.X3,"ScrT3",[SCRc],UL, 860,25,40,20
button #main.X4,"ScrT4",[SCRd],UL, 900,25,40,20
button #main.X5,"ScrT5",[SCRe],UL, 860,49,40,20
button #main.X6,"ScrT6",[SCRf],UL, 900,49,40,20
button #main.X7,"ScrT7",[SCRg],UL, 860,75,40,20
button #main.X8,"PLOT",[PLOTTING],UL, 900,75,40,20
graphicbox #main.PlotIndicator, 900,69,40,6
button #main.X9,"P I P",[PIP],UL, 860,104,40,20
button #main.X10,"Log",[LOG],UL, 900,104,40,20
graphicbox #main.LogIndicator, 900,97,40,6
button #main.mac10, "MP_1", [macP1], UL, 445, 25, 40, 20
button #main.mac11, "MP_2", [macP2], UL, 485, 25, 40, 20
button #main.mac12, "MP_3", [macP3], UL, 525, 25, 40, 20
button #main.mac10, "MP_4", [macP4], UL, 565, 25, 40, 20
button #main.mac10, "Level T", [macP5], UL, 605, 25, 40, 20
button #main.mac10, "Drill T",[macP6] , UL, 645, 25, 40, 20
button #main.maca, "AtoolZ", [AutoTZ], UL, 685, 25, 40, 20
button #main.macb, "SaveM", [SaveM], UL, 725, 25, 40, 20
combobox #main.ldmac, lac$(),[ldmac],765,25,50,20
combobox #main.svmac, mac$(),[svmac],817,25,42,20
button #main.LdGcode, "Opn GCode", [OpenCode], UL, 940, 0, 62, 20
button #main.RunGcode, "Run GCode", [RunCode], UL, 940, 25, 62, 20
button #main.buttonx, "Step GCode", [StepGC], UL, 940, 49, 62, 20
button #main.buttony, "Cls GCode",[CloseGC], UL, 940, 75, 62, 20
button #main.EditGcode, "Edt GCode", [EditCode], UL, 940,104, 62, 20
 
User IP Logged

xtal
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 27
xx Re: LBB runs 7 times slower than LB on my GBRL-Sen
« Reply #53 on: Dec 28th, 2017, 12:32am »

Part 2

Code:
button      #main.path,"<Path$>",[PathClr],UL, 445,70,50,16
graphicbox  #main.PathBox, 445,48,413,20
statictext  #main.drive, "Drive",415,104,30,16
combobox    #main.drvbox, drv$(), comboClick,445,105,50,25
ComboboxColor$ = "yellow"
combobox    #main.selbox1, fdr$(),comboClick,500,104,358,2
ComboboxColor$ = "green"
combobox    #main.selbox2, fil$(),comboClick,500,104,358,2

graphicbox  #main.Fdrbox,445,87,72,17
button      #main.yellow,"Folder", comboClick,UL,455,89,45,12
graphicbox  #main.Filebox,525,87,72,17
button      #main.green,"File",comboClick,UL,535,89,45,12

statictext  #main.nbrfdrname, "#Fdr's",500,70,30,14
textbox     #main.nbrfdr, 535,69,30,17
statictext  #main.nbrfilename, "#File's",570,70,30,14
textbox     #main.nbrfile, 605,69,50,17
statictext  #main.FilLen, "#FileLen", 660,69,50,14
textbox     #main.fbox, 710,69,68,17
button      #main.MZX, "Zx", [MZX], UL, 165, 0, 30, 30
button      #main.MZY, "Zy", [MZY], UL, 165, 35, 30, 30
button      #main.MZZ, "Zz", [MZZ], UL, 165, 70, 30, 30
button      #main.MZR, "ZR", [MZR], UL, 195, 0, 25, 100
stylebits   #main.DROMPx, _ES_RIGHT,0,0,0
textbox     #main.DROMPx, 55, 0, 110, 30
stylebits   #main.DROMPy, _ES_RIGHT,0,0,0
textbox     #main.DROMPy, 55, 35, 110, 30
stylebits   #main.DROMPz, _ES_RIGHT,0,0,0
textbox     #main.DROMPz, 55, 70, 110, 30
stylebits   #main.DROWCx, _ES_RIGHT,0,0,0
textbox     #main.DROWCx, 220, 0, 110, 30
stylebits   #main.DROWCy, _ES_RIGHT,0,0,0
textbox     #main.DROWCy, 220, 35, 110, 30
stylebits   #main.DROWCz, _ES_RIGHT,0,0,0
textbox     #main.DROWCz, 220, 70, 110, 30
stylebits   #main.DROWPx, _ES_RIGHT,0,0,0
textbox     #main.DROWPx, 330, 0, 110, 30
stylebits   #main.DROWPy, _ES_RIGHT,0,0,0
textbox     #main.DROWPy, 330, 35, 110, 30
stylebits   #main.DROWPz, _ES_RIGHT,0,0,0
textbox     #main.DROWPz, 330, 70, 110, 30
listbox     #main.S1, SA$(),[Prm1],476,125,102,108
listbox     #main.S2, SB$(),[Prm2],580,125,102,108
listbox     #main.S3, SC$(),[Prm3],686,125,102,108
listbox     #main.S4, SD$(),[Prm4],792,125,102,108
listbox     #main.S5, SE$(),[Prm5],898,125,102,108
texteditor  #main.PopUp, 500, 250, 475,350
graphicbox  #main.Plot3, 476, 235, 525,405

'------- added for test ?Delay and TicMs

graphicbox  #main.BMPB, 188, 575, 100, 65
button      #main.CLO, "CLOSE", [quit], UL, 198, 584, 80, 25
button      #main.STP, "E-STOP", [ESTOP], UL, 198, 606, 80, 25
statictext  #main.Dly0,"?Delay", 600,87,35,17
textbox     #main.Dly1, 640,87,25,17
statictext  #main.Tic0,"TicMS", 670,87,35,17
textbox     #main.Tic1, 710,87,45,17



Open "Liberty Basic GRBL GUI" for Window as #main
#main "trapclose [quit]"

#main.Filebox, "fill green"
#main.Fdrbox, "fill yellow"
#main.Filebox, "fill green"
#main.BMPB, "fill red"

#main.yellow,"!font roman 6 10"                                   
#main.green,"!font roman 6 10"                                    


td = time$("milliseconds") +5000
while time$("milliseconds") < td
wend

etime=0 : lastsent=0
bucketdelay=15
oldtime=time$("ms")
[LoadMacros]
[Glog]
[ErrLoop1]
[LoopExit]
timer bucketdelay, [ckbuf]
wait

[ckbuf]
Qcnt=Qcnt+1
nowtime=time$("ms")
x$=time$()
elmstime=nowtime-oldtime
elapsedtime=(elmstime)/1000
oldtime=nowtime
etime=etime+elapsedtime

ztime=int((etime/Qcnt)*10000)/10
#main.Dly1, int(ztime)
#main.Tic1, ztime
#main.ManualTx,int(ztime);" - ";ztime

if Qcnt >99 then
 mstime=int((etime/100)*10000)/10
 Xtime$="<";x$;">  <";Qcnt;">  <";etime;"sec>  <";mstime;"msTIC";">"
 #main.GCwindow, Xtime$ 
 print Xtime$ 
 Qcnt=0 : etime=0
 abc=abc+1
end if
if abc=15 then [quit]
if CommOpen=0 then [LoopExit]
[getbuffer]
[getmessage]
[loopx]
[PreProcess]
[StepWait]
[PrintResponse]
goto [LoopExit]
[ESTOP]
[quit]
close #main
END

 




Changed BMPBUTTON
added ?Delay text box and TicMS textbox

added code to write to ?Delay, TicMS, ManualTx boxes

These all dislpay in LB only ManualTx displays in LBB
Also Folder [green] & File [yellow] not displaying very well ?font

Program run after 5 sec LBB will see only ManualTx data


Looking into trying subroutine , it would be pretty big though...
« Last Edit: Dec 28th, 2017, 12:41am by xtal » User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: LBB runs 7 times slower than LB on my GBRL-Sen
« Reply #54 on: Dec 28th, 2017, 09:36am »

on Dec 28th, 2017, 12:32am, xtal wrote:
Looking into trying subroutine , it would be pretty big though...

The code you listed still contains WAIT!? Obviously, replacing the WAIT with a SCAN/Sleep loop is a lot easier than switching to a SUB handler, and it retains compatibility with LB 4. So I am puzzled that you appear not to have tried it, or perhaps you did but haven't reported the results.

If you are hitting other minor incompatibilities between LB 4 and LBB, for example that fonts aren't always exactly the same size, you may need to tweak your code accordingly. Similar issues can arise when running LB programs under Wine, for example, or if the DPI value isn't what you expect.

Richard.

« Last Edit: Dec 28th, 2017, 09:37am by Richard Russell » User IP Logged

Rod
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 110
xx Re: LBB runs 7 times slower than LB on my GBRL-Sen
« Reply #55 on: Dec 28th, 2017, 11:55am »

The code can be made to run much faster without the Timer statement. Loop or Sleep will both cycle the code much faster.

But that isn't the problem we started discussing at the start. Why does Xtal's computer run slowly for LBB and not for LB? Everyone who has tested has reported that they can't see the problem on their machines. So what is broken on Xtal's machine?

If the code is for distribution it would seem wiser to code for a working machine.

What happens if you code a sleep loop? Does the code still run slower?

What happens if you reboot and use Safe Start, does that fix the problem?
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: LBB runs 7 times slower than LB on my GBRL-Sen
« Reply #56 on: Dec 28th, 2017, 1:17pm »

on Dec 28th, 2017, 11:55am, Rod wrote:
The code can be made to run much faster without the Timer statement. Loop or Sleep will both cycle the code much faster.

I'm not suggesting that the OP should remove the Timer statement, but simply to replace the WAIT with a functionally-equivalent SCAN/Sleep loop - exactly as is often necessary when LB is used with WMLiberty.dll. In normal circumstances that won't make any difference to the overall execution speed - internally the WAIT is pretty much equivalent to a SCAN/Sleep loop anyway (at least, in LBB it is).

However since the issue he is encountering seems to be specifically affecting the WAIT statement, anything which replaces it with an alternative formulation holds out the possibility of it fixing - or at least avoiding - the problem.

Quote:
Why does Xtal's computer run slowly for LBB and not for LB?

The reason it affects LBB and not LB is, presumably, because under the hood they are completely different! If, as I hypothesize, it is an unwanted and unexpected side-effect of having some third-party utility installed on the PC, it would be pretty surprising if LB and LBB did respond in the same way!

Quote:
If the code is for distribution it would seem wiser to code for a working machine.

I agree, but the workarounds I have proposed (switching the WAIT for a SCAN/Sleep loop, or using a SUB rather than a branch-label timer handler) don't in any way compromise the performance of the code on a "working machine" so there seems no harm in at least trying them.

Richard.
User IP Logged

xtal
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 27
xx Re: LBB runs 7 times slower than LB on my GBRL-Sen
« Reply #57 on: Dec 28th, 2017, 2:25pm »

Trying sleep just screws up many things , and you never goto [ckbuf]
It would probably need many pgm changes to implement.....

Could the Wait be implemented a while wend timing loop , or would that block event's from happening ......

If I try
Code:
  timer, bucketdelay ckbuf
  next instruction 
 


I assume the end sub will bring me back to the next instruction. I might be able to make that work.......

Also have you ignored that ?Delay & TicMS don't get data while ManualTx does - all textboxes -


changed the last test code....
Code:
[LoopExit]
'timer bucketdelay, [ckbuf]
'wait
timer bucketdelay, ckbufx
goto [ckbuf] 
sub ckbufx
' do nothing
end sub
[ckbuf]

 


Now getting 4.6ms ??????

The ?Delay and TicMS -- still don't update..
will try on main pgm to see what happens....

Yea I know ,, that won't work I have to put the wait in there,but this did show that LB shows 0.2ms to do that simple bit of code while LBB shows 4.6ms ????



« Last Edit: Dec 28th, 2017, 3:02pm by xtal » User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: LBB runs 7 times slower than LB on my GBRL-Sen
« Reply #58 on: Dec 28th, 2017, 3:12pm »

on Dec 28th, 2017, 2:25pm, xtal wrote:
Trying sleep just screws up many things , and you never goto [ckbuf]

That doesn't make sense. Are you sure that you understood what I am suggesting? I want you to replace this single statement:

Code:
    WAIT 

with this short block of code:

Code:
[waitnow]
    SCAN
    calldll #kernel32, "Sleep", 1 as long, r as void
    goto [waitnow] 

This code is functionally the same as a WAIT statement. It isn't plausible that it can "screw up many things" or "never goto [ckbuf]". I can only assume that you have not made the code substitution correctly.

Quote:
I assume the end sub will bring me back to the next instruction.

No. Have you never used a SUB event handler before - not even for a GUI event such as a button click? This is absolutely standard practice (indeed it is preferred over the branch label kind of handler in almost all circumstances). When using SUB handlers control returns to the WAIT statement - that is precisely why I think it might be helpful, because the WAIT gets executed once but never again.

Richard.
« Last Edit: Dec 28th, 2017, 3:33pm by Richard Russell » User IP Logged

xtal
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 27
xx Re: LBB runs 7 times slower than LB on my GBRL-Sen
« Reply #59 on: Dec 28th, 2017, 5:13pm »

[quote author=Richard Russell


No. Have you never used a SUB event handler before - not even for a GUI event such as a button click? This is absolutely standard practice (indeed it is preferred over the branch label kind of handler in almost all circumstances). When using SUB handlers control returns to the WAIT statement - that is precisely why I think it might be helpful, because the WAIT gets executed once but never again.

Richard. [/quote]

I thought the wait was the next instruction..
Anyway Is there any way to pop the return off the stack?

Code:
After correctly adding the sleep the speed increased 
greatly on LBB run , but has +/- 2ms  bounce
while LB run has +/- 0.3ms bounce

The LBB.exe has close to the same as LBB run, with
occasional spikes to 28ms
ManualTx WRITTEN ok  ?Delay -NOT WRITTEN   TicMS -NOT WRITTEN

LBB Run program with sleep 
 ManualTx WRITTEN ok  ?Delay -NOT WRITTEN   TicMS -NOT WRITTEN

Speed INCREASED a lot, but is bumpy +/-2MS  
<12:46:05>  <100>  <1.657sec>  <16.5msTIC>
<12:46:06>  <100>  <1.801sec>  <18msTIC>
<12:46:08>  <100>  <1.773sec>  <17.7msTIC>
<12:46:10>  <100>  <1.736sec>  <17.3msTIC>
<12:46:11>  <100>  <1.685sec>  <16.8msTIC>
<12:46:13>  <100>  <1.816sec>  <18.1msTIC>
<12:46:15>  <100>  <1.762sec>  <17.6msTIC>
<12:46:17>  <100>  <1.709sec>  <17msTIC>
<12:46:18>  <100>  <1.688sec>  <16.8msTIC>
<12:46:20>  <100>  <1.716sec>  <17.1msTIC>
<12:46:22>  <100>  <1.764sec>  <17.6msTIC>
<12:46:24>  <100>  <1.8sec>  <17.9msTIC>
<12:46:26>  <100>  <1.763sec>  <17.6msTIC>
<12:46:27>  <100>  <1.809sec>  <18msTIC>
<12:46:29>  <100>  <1.867sec>  <18.6msTIC>
<12:46:31>  <100>  <1.842sec>  <18.4msTIC>
<12:46:33>  <100>  <1.749sec>  <17.4msTIC>
<12:46:35>  <100>  <1.73sec>  <17.2msTIC>
<12:46:36>  <100>  <1.771sec>  <17.7msTIC>
<12:46:38>  <100>  <1.667sec>  <16.6msTIC>
---DONE-1---

***************************************************************
LB Run program with sleep 
ManualTx WRITTEN ok  ?Delay -WRITTEN ok   TicMS -WRITTEN ok
***************************************************************

Speed stable with +/-0.3ms
<12:51:46>  <100>  <1.562sec>  <15.6msTIC>
<12:51:47>  <100>  <1.562sec>  <15.6msTIC>
<12:51:49>  <100>  <1.568sec>  <15.6msTIC>
<12:51:51>  <100>  <1.58sec>  <15.7msTIC>
<12:51:52>  <100>  <1.558sec>  <15.5msTIC>
<12:51:54>  <100>  <1.559sec>  <15.5msTIC>
<12:51:55>  <100>  <1.567sec>  <15.6msTIC>
<12:51:57>  <100>  <1.567sec>  <15.6msTIC>
<12:51:58>  <100>  <1.555sec>  <15.5msTIC>
<12:52:00>  <100>  <1.562sec>  <15.6msTIC>
<12:52:02>  <100>  <1.569sec>  <15.6msTIC>
<12:52:03>  <100>  <1.565sec>  <15.6msTIC>
<12:52:05>  <100>  <1.571sec>  <15.7msTIC>
<12:52:06>  <100>  <1.562sec>  <15.6msTIC>
<12:52:08>  <100>  <1.56sec>  <15.5msTIC>
<12:52:09>  <100>  <1.564sec>  <15.6msTIC>
<12:52:11>  <100>  <1.563sec>  <15.6msTIC>
<12:52:13>  <100>  <1.564sec>  <15.6msTIC>
<12:52:14>  <100>  <1.579sec>  <15.7msTIC>
<12:52:16>  <100>  <1.566sec>  <15.6msTIC>
---DONE-1---

 

« Last Edit: Dec 28th, 2017, 5:16pm by xtal » User IP Logged

Pages: 1 2 3 4 5  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls