LB Booster
General >> General Board >> LBB runs 7 times slower than LB on my GBRL-Sender
http://lbb.conforums.com/index.cgi?board=general&action=display&num=1508854110

LBB runs 7 times slower than LB on my GBRL-Sender
Post by xtal on Oct 24th, 2017, 2:08pm

I have a LB-pro 4.5.1 GRBL-Sender in progress, I tried compiling /running with LBB ,,,
1st problem > required changing Comport opening ...
'''open P$;":";BaudRate$;",n,8,1,ds0,cs0,rs" for random as #GRBL ' LB
open P$;":";BaudRate$;",n,8,1" for random as #GRBL ' LBB

I have a loop timer running for status interrogating after opening the comm port,,,, LB 4.5.1 pro time loop is 33 seconds laugh
LBB 3.09 time loop is 229 seconds cry

an LB compiled + files zip file is available @


https://sabercathost.com/52ft/LBsave1.zip

I would prefer to use a single exe file instead of exe and many dll's


I also have zip file 676KB but apparently no way to attach

another link:
http://www.filehosting.org/file/details/701092/LBB-save.zip

note: using W10
Re: LBB runs 7 times slower than LB on my GBRL-Sen
Post by Richard Russell on Oct 24th, 2017, 9:13pm

on Oct 24th, 2017, 2:08pm, xtal wrote:
I would prefer to use a single exe file instead of exe and many dll's

If LBB is running significantly more slowly than LB 4 it would suggest that your program is 'untypical'. For example it may be making heavy use of one of the features of Liberty BASIC that is not natively supported by BBC BASIC and therefore needs to be emulated - slowly - at run-time. Here are some examples of things which are slow in LBB and should be avoided for best performance:
You can easily discover where the time is being spent by using the 'Profile' capability of LBB (Run... Profile Program or Ctrl+F5). This should make it obvious where in the program you may need to make adjustments to 'tune' it for best performance in LBB.

Richard.

Re: LBB runs 7 times slower than LB on my GBRL-Sen
Post by xtal on Oct 25th, 2017, 3:36pm

It would have to be
GOSUB, which is deprecated; generally CALL is faster. GOTO is slow too, but you wouldn't use that, would you?! grin
.. I would like to see any code that does a lot, that doesn't contain branch instructions ie goto's rolleyes
as for call vs gosub , put return on stack - then branch -then return ...why would there be a difference? rolleyes

Tried the profile all that it showed was what I would expect , updating display..

The program's timing is slaved to
[LoopExit]
timmer 3 [ckbuf] - wait
[ckbuf]
inc ctr to 1775 - display time - set ctr to 0
if ctr and 31 =31
send status request to GRBL
else
goto [LoopExit]
end if

get/save Comm data - in this case GRBL status
chk if CrLf rcvd - process
-update/display text boxes etc
repeat ---

HM....I forgot how the code works , I think I see where I can improve ....
Thx

Re: LBB runs 7 times slower than LB on my GBRL-Sen
Post by Richard Russell on Oct 25th, 2017, 10:35pm

on Oct 25th, 2017, 3:36pm, xtal wrote:
I would like to see any code that does a lot, that doesn't contain branch instructions ie goto's rolleyes

Oh, come on! GOTO was deprecated decades ago (remember Edsger Dijkstra's letter "Go To Statement Considered Harmful" back in 1968). Of course it's true that some early BASICs provided no alternative, forcing programmers to use GOTO - with an explosion of 'spaghetti code' as a result.

But since sometime in the 1980s most BASICs have provided structured alternatives (BBC BASIC was one of the first to do so, in 1981) and now there is little excuse for using GOTO - I would say none but there are those who insist it still has its uses for things like error handling (but LBB has SEH for that).

Indeed I would turn your statement on its head: show me any "code that does a lot" which is improved by using GOTO rather than Structured Programming constructs (WHILE, DO etc.). It never occurs to me to use GOTO because I have been writing structured BASIC code for at least the last 35 years!

And by the way, LB Booster itself is written in BASIC: over 200 kilobytes of code with not a single GOTO or GOSUB anywhere!

Richard.

Re: LBB runs 7 times slower than LB on my GBRL-Sen
Post by xtal on Oct 25th, 2017, 11:48pm

I was mainly into computer HW for 50 yr and as a side line, I dabbled in programming.
1964-65 Iowa State University Engineering built computer 4k
vacuum tube memory Language = Genie [bet you never heard of that]...
65-66 GE Computers was introduced to their assembly
66-68 US army RCA 501 & RCA 301 used machine lang and assembly
68-72 RCA Spectra Series HW and SW engineer mainly Assembly Lang
72-2013 Univac - Sperry Rand - Sperry - Unisys mainly hardware e

I grew up with machine code, around 1984 RCA introduced the Cosmac Elf 8082 I could only afford to buy the 8082
Built Computer that had 4k ram, tape casette, TV, and Keyboard from keypunch.. I programmed OS for ELF
OS for COSMAC ELF 8082 with 4K ram
Capable of handling 16 program slots and handling many IO slots
[but due to memory restraints could only run 3 slots]
This was all done in machine code!

Played more with assembly, then some RPG,
then more basic[micro-controller], and C++[Arduino].

I've just been seriously playing with LB for the last 6 months writing a GCode sender program to interface with GRBL.
I've used some structured code, which is usually ends up BLOATED and wasting memory, but these days memory is cheap, so why worry about it!

I guess I'm like my grandparents, they just could not waste water[they went thru the big water drought], I just don't want to waste memory [many years I had memory drought].

So I'll keep using goto's, and I like spaghetti, and its easy to control if you are willing to put forth the effort . I find it easier to debug than so called structured, but then my code is structured my way rolleyes

Lets face it While-Wend & Do-Loop in machine code are no more than:
[TAG Location] do-something - GOTO [TAG Location] grin

Structured just hides the goto's

Re: LBB runs 7 times slower than LB on my GBRL-Sen
Post by michael on Oct 26th, 2017, 03:27am

If your talking assembly language

There is no GOTO but there is:

JMP -- Jump unconditionally to label and many more conditional statements that you can mix within a basic program.

If you like assembly language perhaps you will like BBC Basic For Windows, since it has the best of all worlds.

http://www.rtrussell.co.uk/index.html

I only suggest this since there is such a emphasis on that subject. And well, BBC Basic would be A LOT easier to manage than assembly language by itself.

OH and if you really want to.. GOTO and GOSUB are within BBC Basic too.

[labels] are ok, but DEF PROC and DEF FN are far more convienient.

Richard is correct about GOTO. Its more coding, slower, and really has no purpose other than for perhaps a tiny snippet for testing something...

I used to use GOTO and GOSUB all the time.. I only speak of the subject just for this..

Re: LBB runs 7 times slower than LB on my GBRL-Sen
Post by Richard Russell on Oct 26th, 2017, 08:52am

on Oct 26th, 2017, 03:27am, michael wrote:
If you like assembly language perhaps you will like BBC Basic For Windows, since it has the best of all worlds.

Liberty BASIC is better (at least, LBB is)! I would never recommend that anybody move from LB to BBC BASIC. I use Liberty BASIC myself, in preference, whenever I want to write a program containing GUI elements and/or sprites; both have far better support in LB (so long as it's for running on Windows of course).

It's LBB that is "the best of all worlds", not BBC BASIC. Pretty much anything you can do in BBC BASIC you can do in LBB (even assembler code, if you are careful) simply because you can incorporate BBC statements in a LBB program (by prefixing the statements with an exclamation mark) but the reverse isn't true.

Admittedly if I want to run a program in Mac OS or Linux or Android, or on a Raspberry Pi, then I do use BBC BASIC because there is a cross-platform version. Despite various announcements over the years, there will probably never be a cross-platform implementation of Liberty BASIC.

Of course, under limited circumstances (e.g. when there are no GUI or graphics elements), you can use LBB as a 'Liberty BASIC to BBC BASIC translator' and by that means run a program originally written in LB on those other platforms. Select 'Show LBB pane' in the Options menu to see the translation.

Richard.

Re: LBB runs 7 times slower than LB on my GBRL-Sen
Post by xtal on Dec 21st, 2017, 9:06pm

The problem seems to be associated with timer xx,[jump]
I have stripped down coding , but is too big to post, I will try to remove buttons/etc...

I have noticed a quirk I can't explain, I enabled print window and added print Qcnt.... This runs slow until I move the print window, then it speeds up ??? LBBrun runs slower than LB 46 sec vs 28 sec
LBB exec runs 450 sec ---- below is code without page format
-change print to #main.WinStatus, Qcnt

Code:
bucketdelay=3
'------------------------------------------------------------------------------------------------------
    Thirty=time$("seconds")                                       ' seconds since midnight                                                                 '
  Open "Liberty Basic GRBL GUI" for Window as #main               '
    #main "trapclose [quit]"                                      '
'----------------------------------------------------------------------------------------------------
  #main.GCwindow, "TotalScreen Width = "; DisplayWidth            '
  #main.GCwindow, "TotalScreen Height = ";  DisplayHeight         '
  x$=time$()                           ' setup 1st time msg
  TmvalNu=val(mid$(x$,4,2))*60         ' setup 1st time msg
  TsvalNu=val(right$(x$,2))+TmvalNu    ' setup 1st time msg
'=======================================================================================================
[LoadMacros]   '' code removed                                                    '
[Glog]         '' code removed                                                    '
[ErrLoop1]     '' code removed                                                    '
[LoopExit]     '' code removed                                                    ' wait for user input
    timer bucketdelay, [ckbuf]                                    ' every 3 ms ckbuf
    wait                                                          '
'--------------------------------------------------------------------------------------------------------
[ckbuf]                                                          '
    Qcnt=Qcnt+1                                                  '
 ''   print Qcnt;"-";    '' added speeds up when move window
  #main.WinStatus, Qcnt  '' trying this
'--------------------------------------------------------------------------------------------------------
  if Qcnt >1775 then                                             ' approx 30+ sec elapsed
      x$=time$()                                                 '
      TsvalOld=TsvalNu                                           ' last total seconds -> old
      TmvalOld=TmvalNu                                           ' last m*60  seconds -> old
      TmvalNu=val(mid$(x$,4,2))*60                               ' get nu m *60 seconds 9*60=540 0*60=0 ==600
      TsvalNu=val(right$(x$,2))+TmvalNu                          ' compute new total seconds
      xx = abs(TsvalNu-TsvalOld)                                 ' compute new-old
      #main.GCwindow, "<";Qcnt;">  <";xx;"> ";x$                 ' 1st display & every hour = funny number
      Qcnt=0                                                     '
  end if                                                         '
  if CommOpen=0 then [LoopExit]                                  ' can't get input if comm closed
'-----------------------------------------------------------------------------------------------------
[getbuffer]      '' code removed                                '
'-----------------------------------------------------------------------------------------------------
[getmessage]       '' code removed                                              '

[loopx]             '' code removed                                             '
'------------------------------------------------------------------------------------------------------
[PreProcess]                                                    '
 '' timer 0                                                       ' stop timer until line processed *****
 '' code removed
[StepWait]
 '' code removed
'==================================================================================================
[PrintResponse]                                                 ' 3 ms 28a
       '' code removed
      goto [LoopExit]                                           ' **************************
'==================================================================================================
[ESTOP]
'==================================================================================================
[quit]                                                          '
      '' code removed
     close #main                                                ' main window
END                                                             ' must stop main



 


Re: LBB runs 7 times slower than LB on my GBRL-Sen
Post by xtal on Dec 21st, 2017, 9:41pm

After removing 90% of my button, etc.
LBBrun is 28 sec LBB exe is 100 seconds LB is 28 seconds

hmmmm LBB has problem with how many buttons etc????
I have approx
130 buttons
12 graphic boxes
2 text editor
7 list boxes
6 text boxes
4 combo boxes
15 statictext
Code:
[InitColors]
    'Please use default colors when possible.
    'ForegroundColor$ = "Black"
    'BackgroundColor$ = "Buttonface"
    True = 1 : False = 0
'------------ 
[WindowSetup]
 NOMAINWIN                                               '    allow no print window
    WindowWidth = 1020 : WindowHeight = 700   '877
    UpperLeftX = INT((DisplayWidth-WindowWidth)/2)        '    UpperLeftX = DisplayWidth-WindowWidth
    UpperLeftY = INT((DisplayHeight-WindowHeight)/2)      '    UpperLeftY = DisplayHeight-WindowHeight
    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]
bucketdelay=3
'-------------- 
[ControlSetup]
'-------------- 
statictext  #main.statictext2, "MPOS", 60, 105, 40, 20
statictext  #main.statictext3, "WCO", 230, 105, 25, 20
statictext  #main.statictext4, "WPOS", 350, 105, 40, 20 
textbox     #main.ManualTx, 5, 475, 470, 20                                   ' over-down-width-height
stylebits   #main.Enter, _BS_DEFPUSHBUTTON,0,0,0                              ' Enable ENTER Key
button      #main.Enter,"",[Enter],UL,473,475,5,20                            ' hidden button sort of !
button      #main.ManualSend, "SEND COMMANDS", [SEND], UL, 190, 500, 180, 20 
'=========== 
texteditor  #main.WinStatus, 55,125, 420, 80         ' LBB adjust   ' Top left Corner - over, down
texteditor  #main.GCwindow, 55, 210, 420, 260        ' LBB adjust   ' bottom right - width, down
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                                   ' **************
'--------- 
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                          ' Right Justify & TextboxColor$ = "White"
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  '480                   '
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                        ' home is 0,405
 
'   START UP VALUES 
    Thirty=time$("seconds")                                       ' seconds since midnight                                                                 '
  Open "Liberty Basic GRBL GUI" for Window as #main               '
    #main "trapclose [quit]"                                      '
'------------ 
  #main.GCwindow, "TotalScreen Width = "; DisplayWidth            '
  #main.GCwindow, "TotalScreen Height = ";  DisplayHeight         '
  x$=time$()                           ' setup 1st time msg
  TmvalNu=val(mid$(x$,4,2))*60         ' setup 1st time msg
  TsvalNu=val(right$(x$,2))+TmvalNu    ' setup 1st time msg
'============= 
[LoadMacros]   '' code removed                                                    '
[Glog]         '' code removed                                                    '
[ErrLoop1]     '' code removed                                                    '
[LoopExit]     '' code removed                                                    ' wait for user input
    timer bucketdelay, [ckbuf]                                    ' every 3 ms ckbuf
    wait                                                          '
'--------------------------------------------------------------------------------------------------------
[ckbuf]                                                          '
    Qcnt=Qcnt+1                                                  '
 ''   print Qcnt;"-";    '' added speeds up when move window
  #main.WinStatus, Qcnt  '' trying this
'--------------------------------------------------------------------------------------------------------
  if Qcnt >1775 then                                             ' approx 30+ sec elapsed
      x$=time$()                                                 '
      TsvalOld=TsvalNu                                           ' last total seconds -> old
      TmvalOld=TmvalNu                                           ' last m*60  seconds -> old
      TmvalNu=val(mid$(x$,4,2))*60                               ' get nu m *60 seconds 9*60=540 0*60=0 ==600
      TsvalNu=val(right$(x$,2))+TmvalNu                          ' compute new total seconds
      xx = abs(TsvalNu-TsvalOld)                                 ' compute new-old
      #main.GCwindow, "<";Qcnt;">  <";xx;"> ";x$                 ' 1st display & every hour = funny number
      Qcnt=0                                                     '
  end if                                                         '
  if CommOpen=0 then [LoopExit]                                  ' can't get input if comm closed
'------------[getbuffer]      '' code removed                                '
[getmessage]       '' code removed                                              '
[loopx]             '' code removed                                             '
[PreProcess]                                                    '
 '' timer 0                                                       ' stop timer until line processed *****
 '' code removed
[StepWait]
 '' code removed
[PrintResponse]                                                 ' 3 ms 28a
       '' code removed
      goto [LoopExit]                                           ' **************************
[ESTOP]
[quit]                                                          '
      '' code removed
     close #main                                                ' main window
END                                                             ' must stop main


 

Re: LBB runs 7 times slower than LB on my GBRL-Sen
Post by Richard Russell on Dec 21st, 2017, 10:44pm

on Dec 21st, 2017, 9:41pm, xtal wrote:
This runs slow until I move the print window, then it speeds up ?

This is almost certainly a sign of CPU throttling. If you are using a laptop it is not uncommon. Go into Windows' performance settings and force the CPU to run at full speed: it will drain the battery, but at least anomalies such as this shouldn't happen.

Quote:
After removing 90% of my button, etc.
LBBrun is 28 sec LBB exe is 100 seconds LB is 28 seconds

There are three ways of running a program using LBB: one is to run it from the LBB IDE, the second is to 'compile' it to an EXE and run that, the third way is to export a tokenised program and run that using LBBRUN.exe.

Because of the way LBB works, there will never be a significant difference between the execution speed of these three methods. The 'compiled' EXE may be slightly faster than the other two, but only a few percent at most.

I think I said this before, but if you want to find out why LBB is slower than LB, then use the profiler (Run... Profile Program menu selection or Ctrl+F5). This will show you exactly where the time is being spent.

I could make LBB significantly faster than it is, by replacing the LBLIB library (coded in BBC BASIC - one of the slowest BASICs) with a DLL coded in C. But I'm not going to do that, partly because it would be a lot of work and partly because LBB is intended to be a showcase for BBC BASIC.

Richard.

Re: LBB runs 7 times slower than LB on my GBRL-Sen
Post by Richard Russell on Dec 22nd, 2017, 12:11am

on Dec 21st, 2017, 9:41pm, xtal wrote:
Code:
    bucketdelay=3
    timer bucketdelay, [ckbuf]  ' every 3 ms ckbuf
    wait 

Don't forget that, in both LB 4 and LBB, the shortest timer period is about 10 ms. Attempting to set it to 3 ms, as in your code, won't result in an error but it won't make it any faster.

Richard.

Re: LBB runs 7 times slower than LB on my GBRL-Sen
Post by xtal on Dec 22nd, 2017, 11:11am

Thx for the 3 ms info, I knew there was a limit somewhere , just didn't know what it was rolleyes

As for CPU Throttle ? I'm running a QuadCore Desktop with 8GB memory, So I don't suspect any throttling and will attempt to check it out, but if that is the problem then why moving the print window would make it speed up huh

And why the speed increase after removing many button's etc,, the screen display only has 2 texteditor windows in play in this example embarassed
Re: LBB runs 7 times slower than LB on my GBRL-Sen
Post by tsh73 on Dec 22nd, 2017, 12:58pm

xtal,
I've run your code from Reply #8
(EDIT: on Win XP upon Intel Core I5)
LBB
28 sec
produced EXE
28 sec
produced LBB, run with LBBRUN.exe
28 sec

BTW
1776*0.016 is 28.416

So if you have more that should mean some stuff between WAIT took more then 16 ms (not say 3 ms your planned)
(so it fired on next 16'th. Or some next after that)

You probably should try profiler to see that takes time.
Re: LBB runs 7 times slower than LB on my GBRL-Sen
Post by Rod on Dec 22nd, 2017, 1:32pm

Anything to do with the Windows timer takes time. Free running your code was looping in 0-1 second on my machine. introducing any form of time$( timer function drags the system down. As Richard says it adds 10 or more milliseconds of wasted time per loop. If you need it to run that fast consider other code as a time waster, or worst case a while wend loop that balances the time delay you need.

But why are you needing the delay? if the display is live and reading stuff real time what is the point of the delay?
Re: LBB runs 7 times slower than LB on my GBRL-Sen
Post by Richard Russell on Dec 22nd, 2017, 4:14pm

on Dec 22nd, 2017, 11:11am, xtal wrote:
but if that is the problem then why moving the print window would make it speed up huh

Windows gives processes that the user is interacting with a higher priority, so it's possible that moving a window may increase the CPU clock rate of the core that your program is running on. You can try using a tool like CPU-Z to monitor the clock speeds.

Quote:
And why the speed increase after removing many button's etc

Most likely a coincidence. One plausible way in which the presence of many buttons could affect execution speed is if the additional memory usage causes cache thrashing. But I would expect the effect to be small.

In your program most of the time (around 90% here) is spent in the WAIT statement, as you would expect, so the execution time is pretty much determined by that.

Don't speculate, run the profiler!

Richard.

Re: LBB runs 7 times slower than LB on my GBRL-Sen
Post by xtal on Dec 22nd, 2017, 5:49pm

I modified the test pgm, added back the print window, and I only have to click on the window for the program to speed up?

I was trying to verify the 10Ms , and
LB setting Bucketdelay using run program on LB and LBB
10-15 I get 15 ms delay
16 I get 25 ms delay
17-? I get 31 ms

LBB 10-12 I get 15 ms delay [must click print window 2 speedup on LBB but not on LB]]
13 - ? time starts increasing

I didn't expect to see these #'s
Could be Win10 Pro issue with unexpected delays?

Tried profiler , but I can't determine squat from it other than a big count at the wait .....

I think I lucked out getting My GCode sender working .
Re: LBB runs 7 times slower than LB on my GBRL-Sen
Post by Richard Russell on Dec 22nd, 2017, 10:12pm

on Dec 22nd, 2017, 5:49pm, xtal wrote:
I only have to click on the window for the program to speed up?

Clicking on a window activates it, and brings the process to the foreground. So this suggests that non-foreground processes are running much more slowly than they should. Have you checked with Task Manager or Resource Monitor to see what processes are using CPU time? Is it possible that you have some 'zombie' LB or LBB programs still running (invisibly), for example because of not including a trapclose?

Quote:
Tried profiler , but I can't determine squat from it other than a big count at the wait .....

If the profiler is not recording the delays, multimedia interrupts (timeSetEvent) are not running properly, and if multimedia interrupts - which have a high priority - are not running, something is seriously broken!

Richard.

Re: LBB runs 7 times slower than LB on my GBRL-Sen
Post by Rod on Dec 23rd, 2017, 10:22am

These delays are exactly what you should expect from the Windows timer. I always describe the timer as a clock face that only changes every 16ms or so.

Now this is a problem for the timer command because it has to look at the clock face and react when the desired time is shown. It seems we cannot see the time change faster than 16ms so it is pointless coding timer delays below this value.

Also because we start mid cycle it is variable, lengthening the delay does not help as you have seen because you tend to go up in 16ms increments and so jump from 16ms to 32ms.

So at the timings you are trying to get the timer is useless to you. Drop it and try SLEEP or simply loop.

That way you will lose your massive WAIT dely.

Re: LBB runs 7 times slower than LB on my GBRL-Sen
Post by xtal on Dec 23rd, 2017, 1:20pm

If your thinking the 28 sec is a massive wait, it is not, it's just an indicator that the program is running without any unexpected delays, The bucketdelay wait is being used to process any serial data. Sometimes I have to stop the timer when going GCode processing / file reading etc, because invalidtag tag [ckbuf] is intermittantly displayed, then restart timer when leaving the code. Other than that the GCode pgm runs fine under LB.

Re: LBB runs 7 times slower than LB on my GBRL-Sen
Post by Rod on Dec 23rd, 2017, 2:00pm

smiley No, I was thinking 16ms is a massive delay if you have a lot to do.
Re: LBB runs 7 times slower than LB on my GBRL-Sen
Post by Richard Russell on Dec 23rd, 2017, 5:30pm

on Dec 23rd, 2017, 2:00pm, Rod wrote:
smiley No, I was thinking 16ms is a massive delay if you have a lot to do.

As far as I can see the OP is using the timer appropriately. As I understand it he is using it to process incoming serial data, so the important thing is that the serial input buffer cannot overflow between one timer 'tick' and the next. 16ms is not a "massive" amount of time from this perspective: even at 115,200 baud the maximum amount of data that can be received in 16ms is fewer than 200 bytes, which is much smaller than the size of the input buffer.

Richard.

Re: LBB runs 7 times slower than LB on my GBRL-Sen
Post by Richard Russell on Dec 23rd, 2017, 9:21pm

on Dec 23rd, 2017, 1:20pm, xtal wrote:
invalidtag tag [ckbuf] is intermittantly displayed

LB 4 has a bug which means that you cannot (safely) use the timer with a SUB handler but only with a branch label. This means that, as you found, it is possible for a timer event to fire when the target label is out-of-scope (e.g. when your program's execution is inside a sub or function), causing an error to be reported.

You can work around this by ensuring that your program never executes a SCAN or WAIT statement when inside a function or sub, that way the timer handler will only be called when its target is in scope. But that's a serious limitation; for example it prevents you encapsulating a GUI window and all its control handlers inside a SUB, which is often desirable from a structured programming viewpoint.

Fortunately LBB does not have that bug. You can safely use a SUB handler for your timer events, and since SUBs are always in scope you can use SCAN or WAIT statements anywhere you like within your program without any risk of an error. Of course you will probably want to make all your other event handlers SUBs as well, but that's good practice anyway (and works in LB).

Richard.
Re: LBB runs 7 times slower than LB on my GBRL-Sen
Post by xtal on Dec 24th, 2017, 3:18pm

modified my complete program Many buttons etc...

LB = RUN LBB = RUN Program
''display TIC value - stop timer - set timer
[LoopExit] ' Display tic amount = 15 that I'm setting
#main.GCwindow, "Set TIC=";bucketdelay
timer 0
timer bucketdelay, [ckbuf] ' every 15 ms ckbuf
wait
' Set cnt to 99 instead of 1775
if Qcnt >99 then
'' COMPUTE TIC Time in millisec
mstime=int((etime/100)*10000)/10

LB = Run
Opened Dec 24, 2017 - 10:15:27
<10:15:28> <100> <1.659sec> <16.5msTIC>
<10:15:30> <100> <1.732sec> <17.3msTIC>
<10:15:32> <100> <1.697sec> <16.9msTIC>
<10:15:34> <100> <1.627sec> <16.2msTIC>
Closed Dec 24, 2017 - 10:15:34

Task mgr chrome 0.1-.3% lbpro 1-6%
notepad 0.1% taskmgr .3-1.1%


LBB = Run Program
Opened Dec 24, 2017 - 10:30:22
<10:34:52> <100> <314.259sec> <3142.5msTIC>
<10:40:03> <100> <311.731sec> <3117.3msTIC>
<10:45:16> <100> <312.729sec> <3127.2msTIC>
<10:50:27> <100> <310.503sec> <3105msTIC>
<10:55:37> <100> <310.218sec> <3102.1msTIC>
<11:00:49> <100> <311.957sec> <3119.5msTIC>
Closed Dec 24, 2017 - 11:05:06
--wow 3 second TIC time SB 15+ ms
Task mgr chrome 0.1-.3% LB Booster .1-1.3%
notepad 0.1% taskmgr .3-1.1%



Earlier I saw BBCwrun6 in task mgr apps @ 30% I have no Idea what that was , but now its gone ...
Again this is W10 pro
Tried compatility run whit same results
Re: LBB runs 7 times slower than LB on my GBRL-Sen
Post by Richard Russell on Dec 24th, 2017, 4:10pm

Please show us the profiler report (you can edit out all the lines that show zero time, to reduce the size).

Richard.

Re: LBB runs 7 times slower than LB on my GBRL-Sen
Post by xtal on Dec 24th, 2017, 6:11pm

[copy]
Start Copy
Profiler report for C:\Users\msw10\AppData\Roaming\Liberty BASIC Pro v4.5.1\GRBL-NU5DggmZ10h-lbb.bas

Sun. 24 Dec 2017, 12:48:14

Figures in the first column indicate approximate
time in milliseconds spent in each program line.

Figures in the second column indicate approximate
percentage of the time spent in each program line.

Time spent profiling: 350.024 seconds.

82: 0.02 '** Liberty BASIC 4.51 pro - 3/14/2017 GCode Sender using GRBL 1.1F Program with simple Graphics
2: dim info$(BrowseLen,BrowseLen) ' folder and file
8: Menu #main, "DROreset", "Reset MPX", [ZX], "Reset MPY", [MZY], "Reset MPZ", [MZZ], "ResetALL", [MZR]
6: Menu #main, "HELP", "Q/A.txt", [HELPx],"LibertyBasic.chm",[HELPchm],"LB-Forum",[HELPforum]
8: Menu #main, "DEBUG","--NA1--",[XBUG1],"--NA2--",[XBUG2],"DLY15/35",[DLY32],"DLY25/45",[DLY48],"DLY55/75",[DLY64],"DLY70/90",[DLY80],"DLY85/105",[DLY96]
2: button #main.params,"$$ Stat", [PARAMS], UL, 5, 400, 45, 20
2: button #main.JZMa,"--",[JZMa],UL,125,549,12,13 '
2: button #main.JZFg,"--",[JZFg],UL,151,624,14,13 '
4: texteditor #main.WinStatus, 55,125, 420, 80 ' LBB adjust ' Top left Corner - over, down
2: texteditor #main.GCwindow, 55, 210, 420, 260 ' LBB adjust ' bottom right - width, down
4: bmpbutton #main.EMRRESET, BMPdir$;"estop6.bmp",[ESTOP],UL, 188,575 ' EM STOP / CLOSE
2: button #main.mac6, "Mac6", [mac6], UL, 687, 0, 40, 20
2: button #main.RunGcode, "Run GCode", [RunCode], UL, 940, 25, 62, 20
2: button #main.MZR, "ZR", [MZR], UL, 195, 0, 25, 100 '
4: texteditor #main.PopUp, 500, 250, 475,350 '
1124: 0.32 Open "Liberty Basic GRBL GUI" for Window as #main '
4: #main.Status "setfocus" 'MUST setfocus to graphicbox '
2: #main.PopUp, "!hide" '
2: #main.selbox2, "hide" ' hide this box
2: #main.Filebox,"backcolor green" '
4: #main.yellow,"!font roman 6 10" '
4: #main.green,"!font roman 6 10" '
2: #main.yellow,"Folder" '
2: #main.green,"File" '
6: #main.JX, str$(JXvar) : #main.JY, str$(JYvar) : #main.JZ, str$(JZvar)
6: #main.JXF, "F";str$(JXFvar) : #main.JYF,"F";str$(JYFvar) : #main.JZF,"F";str$(JZFvar)
2: magnify=1 : #main.Mag1,1 ' show magnifer value
2: plotxy=2 : #main.PLOTa,"TL" '
2: #main.GCwindow, "TotalScreen Height = "; DisplayHeight '
2: if len(P$)>0 then #main.Comx, P$ '
2: if len(BaudRate$)>0 then #main.Baud, BaudRate$ '
26: 0.01 #main.GCwindow, "Set TIC=";bucketdelay
32504: 9.29 wait '
2: #main.GCwindow, Xtime$ '
74: 0.02 #GRBL, "?"; '' Keep semicolen so ok-ok won't display ' approx 100 ms interval '' not sure how semicolen does this
8: #main.Dly1, int((AvgTime/25)+.5) '
2: comlof=lof(#GRBL) ' lof >1 data is in buffer
12: if comlof>= 1 then GRBLin$ = GRBLin$ + input$(#GRBL,comlof) ' save comm data to GRCLin$
4: timer 0 ' stop timer until line processed *****
2: Ze=instr(WIN$,"|",2) : winswitch = 1 ' <Idle|MPos
2: Ze$=mid$(WIN$,2,Ze-2) ' isolate Status
2: call DROWCOUPDATE ' [WCO_Update][MPOS_Update] [WPOS_Update]
2: else ' " <~~~~~~~~~~~~~~~~~~~~~~~> "
62: 0.02 #main.WinStatus, "<";Qcnt;"> ";win$ ' print <~~~~~~~> msg in status window
4: #GRBL, "M5" ' ensure spindle off
34: 0.01 Q=DelayMS(500) ' wait 1/2 second
34: 0.01 Q=DelayMS(500) ' wait 1/2 second
2: close #GRBL ' comm port
36: 0.01 close #main ' main window
31032: 8.87 #main.DROWCx, "!font arial 14" '
30944: 8.84 #main.DROWCy, "!font arial 14" '
164: 0.05 #main.DROWCy, WCY ' update WCOy
172: 0.05 #main.DROWCz, WCZ ' update WCOz
31016: 8.86 #main.DROMPx, "!font arial 14" '
166: 0.05 #main.DROMPx, MPX ' load MPOSx
31102: 8.89 #main.DROMPy, "!font arial 14" '
166: 0.05 #main.DROMPy, MPY ' load MPOSy
156: 0.04 #main.DROMPz, MPZ ' load MPOSz
31018: 8.86 #main.DROWPx, "!font arial 14" '
166: 0.05 #main.DROWPx, MPX - WCX ' load WPOSx
31072: 8.88 #main.DROWPy, "!font arial 14" '
31014: 8.86 #main.DROWPz, "!font arial 14" '
912: 0.26 while time$("milliseconds") < td '
18: 0.01 wend '
31834: 9.09 #main.Status, "font Courier_New ";fontsize$ '
126: 0.04 #main.Status, "cls" ' clr graphics box
94: 0.03 #main.Status, "fill ";color$ ' fill yellow
16: #main.Status, "backcolor ";color$ ' text background
4: #main.Status, "place "laughl$;" "laughd$ ' from top left over->grinown
346: 0.10 #main.Status, "\"grinata$ ' print data
54: 0.02 #main.GCwindow, "CommPort <"laugh;"> checked at ";time$() '
94: 0.03 open "Com";str$(p);":115200,n,8,1" for random as #com ' use this for LBB
4: close #com '
2: [trap] '
2: #main.Baudrate, "!" ' clr listbox 'BaudRate$
8: open P$;":";BaudRate$;",n,8,1" for random as #GRBL ' LBB
2: #main.Baudrate, "!";BaudRate$ ' combo select box
2: #main.Comx, P$ ' testbox
2: #main.Baud, BaudRate$ ' test box
2: #main.GCwindow, P$;" WAS / IS OPEN " '
4: #GRBL, CTLx$ '
4: #GRBL, "$$" ' request params
276: 0.08 wait '
2: #main.GCwindow, "GcodeDir$ = ";GcodeDir$ '
4: #main.GCwindow, "BMPdir$ = ";BMPdir$ '
2: #main.GCwindow, "EditPath$ = ";EditPath$ '
2: #main.GCwindow, "GUI-1Line-[Mac";x;"] = "; Macro$(x) '
8: #main.GCwindow, "<";x;"> ";MP1$(x) '
2: #main.GCwindow, "<";x;"> ";MP2$(x) '
4: #main.GCwindow, "<";x;"> ";MP3$(x) '
2: #main.GCwindow, "<";x;"> ";MP4$(x) '
2: StatusDly=55 : wait ' approx 64
392: 0.11 Calldll #user32, "ScreenToClient",_
758: 0.22 (Unaccounted for)
Finish Copy

[/code]
Re: LBB runs 7 times slower than LB on my GBRL-Sen
Post by xtal on Dec 24th, 2017, 6:17pm

Ran LBB on older laptop with WinXP and it also has the big delays
Re: LBB runs 7 times slower than LB on my GBRL-Sen
Post by tsh73 on Dec 24th, 2017, 8:19pm

Hello xtal
Looking to profiler report - long time is spent changing fonts.
Are you by chance changing font in a loop?
Is there any reason to change font at all - not to set it right after opening window, once and for all?
Re: LBB runs 7 times slower than LB on my GBRL-Sen
Post by Richard Russell on Dec 24th, 2017, 9:43pm

on Dec 24th, 2017, 8:19pm, tsh73 wrote:
long time is spent changing fonts

Exactly. As I suggested from the start, the profiler makes the cause of the slowness obvious.

I expect LB 4 checks to see whether the selected font happens to be the same as what was previously selected, and ignores the command if so. LBB doesn't do that, because I had no reason to suspect that anybody would keep selecting the same font repetitively.

All in all, a bit of a wild (Christmas) goose chase!

Richard.
Re: LBB runs 7 times slower than LB on my GBRL-Sen
Post by xtal on Dec 24th, 2017, 10:10pm

I noticed I was setting the same font on the DRO, when the profiler was running, I just set the font every time I entered a procedure.

I will remove some of the redundant font settings, and see what happens, but keep in mind that the shortened program was
having issues, and it had very little font changes... shocked

thx all
Re: LBB runs 7 times slower than LB on my GBRL-Sen
Post by Richard Russell on Dec 24th, 2017, 11:12pm

on Dec 24th, 2017, 10:10pm, xtal wrote:
keep in mind that the shortened program was having issues

Sort out your coding flaws first: eliminate unnecessary repetitions, set the font just once when the window is created, don't update controls faster than somebody can read the changes etc.

Then, and only then, check whether there are any remaining issues. Until that point I'm not "keeping anything in mind" because as far as I'm concerned there is nothing wrong with LBB.

Richard.

Re: LBB runs 7 times slower than LB on my GBRL-Sen
Post by xtal on Dec 25th, 2017, 01:22am

Using the full program with fonts usage changed..
If I remark out NOMAINWIN [ie] enable a print window
and not using any print cmds

Run program and open Comm port
program window selected code runs slow angry
print window selected code runs fast rolleyes shocked
program window selected code runs slow angry
etc, etc, etc huh
Re: LBB runs 7 times slower than LB on my GBRL-Sen
Post by Rod on Dec 25th, 2017, 07:42am

So what is the profiler telling us when you run slow and what when you run fast?
Re: LBB runs 7 times slower than LB on my GBRL-Sen
Post by xtal on Dec 25th, 2017, 12:45pm

Running fast Profile Program terminates after 3rd tic msg

Profiler report for C:\Users\msw10\AppData\Roaming\Liberty BASIC Pro v4.5.1\GRBL-NU5DggmZ10h-lbb-100.bas

Mon. 25 Dec 2017, 07:37:00

Figures in the first column indicate approximate
time in milliseconds spent in each program line.

Figures in the second column indicate approximate
percentage of the time spent in each program line.

Time spent profiling: 12.726 seconds.

86: 0.68 '** Liberty BASIC 4.51 pro - 3/14/2017 GCode Sender using GRBL 1.1F Program with simple Graphics
8: 0.06 Menu #main, "DROreset", "Reset MPX", [ZX], "Reset MPY", [MZY], "Reset MPZ", [MZZ], "ResetALL", [MZR]
6: 0.05 Menu #main, "HELP", "Q/A.txt", [HELPx],"LibertyBasic.chm",[HELPchm],"LB-Forum",[HELPforum]
2: 0.02 button #main.Pause, "Pause", [PAUSE], UL, 5, 450, 45, 20
2: 0.02 button #main.JZMd,"--",[JZMd],UL,158,549,12,13 '
6: 0.05 texteditor #main.WinStatus, 55,125, 420, 80 ' LBB adjust ' Top left Corner - over, down
2: 0.02 texteditor #main.GCwindow, 55, 210, 420, 260 ' LBB adjust ' bottom right - width, down
4: 0.03 bmpbutton #main.EMRRESET, BMPdir$;"estop6.bmp",[ESTOP],UL, 188,575 ' EM STOP / CLOSE
2: 0.02 button #main.mac7, "Mac7", [mac7], UL, 728, 0, 40, 20
2: 0.02 button #main.EditGcode, "Edt GCode", [EditCode], UL, 940,104, 62, 20
2: 0.02 textbox #main.DROMPx, 55, 0, 110, 30 ' Right Justify & TextboxColor$ = "White"
2: 0.02 texteditor #main.PopUp, 500, 250, 475,350 '
4: 0.03 #main.Status "setfocus" 'MUST setfocus to graphicbox '
14: 0.11 #main "font ms_sans_serif 8" ' was 10 slightly to big
296: 2.33 #main.Status, "font arial 24"
2: 0.02 #main.DROWCx, "!font arial 14" ' Digital Read Out font size 14
2: 0.02 #main.DROWCy, "!font arial 14"
4: 0.03 #main.DROMPx, "!font arial 14"
2: 0.02 #main.DROMPy, "!font arial 14"
6: 0.05 #main.DROMPz, "!font arial 14"
2: 0.02 #main.DROWPx, "!font arial 14"
2: 0.02 #main.DROWPy, "!font arial 14"
2: 0.02 #main.DROWPz, "!font arial 14"
2: 0.02 #main.green,"!font roman 6 10" '
2: 0.02 #main.yellow,"Folder" '
2: 0.02 #main.green,"File" '
2: 0.02 #main.PopUp, "!hide" '
2: 0.02 #main.Filebox,"fill green" '
2: 0.02 #main.JX, str$(JXvar) : #main.JY, str$(JYvar) : #main.JZ, str$(JZvar)
4: 0.03 #main.JXF, "F";str$(JXFvar) : #main.JYF,"F";str$(JYFvar) : #main.JZF,"F";str$(JZFvar)
2: 0.02 magnify=1 : #main.Mag1,1 ' show magnifer value
2: 0.02 if len(P$)>0 then #main.Comx, P$ '
2: 0.02 if len(BaudRate$)>0 then #main.Baud, BaudRate$ '
2: 0.02 call GetCommPorts ' scan & load com#'s array
4: 0.03 timer bucketdelay, [ckbuf] ' every 15 ms ckbuf
2: 0.02 #main.GCwindow, Xtime$ '
116: 0.91 #GRBL, "?"; '' Keep semicolen so ok-ok won't display approx 100 ms interval not sure how semicolen does this
6: 0.05 comlof=lof(#GRBL) ' lof >1 data is in buffer
4: 0.03 timer 0 ' stop timer until line processed *****
2: 0.02 Ze=instr(WIN$,"|",2) : winswitch = 1 ' <Idle|MPos
4: 0.03 #GRBL, "M5" ' ensure spindle off
26: 0.20 Q=DelayMS(500) ' wait 1/2 second
2: 0.02 #GRBL, CTLx$; ' send soft reset
32: 0.25 Q=DelayMS(500) ' wait 1/2 second
2: 0.02 close #GRBL ' comm port
3564: 28.01 END ' must stop main here
2: 0.02 #main.DROWCx, WCX ' update WCOx
2: 0.02 #main.DROWCy, WCY ' update WCOy
2: 0.02 #main.DROWCz, WCZ ' update WCOz
2: 0.02 #main.DROMPy, MPY ' load MPOSy
2: 0.02 #main.DROMPz, MPZ ' load MPOSz
2: 0.02 #main.DROWPx, MPX - WCX ' load WPOSx
2: 0.02 #main.DROWPy, MPY - WCY ' load WPOSy
2: 0.02 #main.DROWPz, MPZ - WCZ ' load WPOSy
918: 7.21 while time$("milliseconds") < td '
22: 0.17 wend '
92: 0.72 open "Com";str$(p);":115200,n,8,1" for random as #com ' use this for LBB
4: 0.03 close #com '
36: 0.28 #main.CommPort, "reload" '
2: 0.02 #main.Baudrate, "!" ' clr listbox 'BaudRate$
2: 0.02 #main.CommPort, "!" ' clr listbox 'laugh$
8: 0.06 open P$;":";BaudRate$;",n,8,1" for random as #GRBL ' LBB
2: 0.02 #main.CommPort, "!"laugh$ ' combo select box
2: 0.02 #main.Comx, P$ ' testbox
2: 0.02 #main.Baud, BaudRate$ ' test box
2: 0.02 #main.GCwindow, P$;" WAS / IS OPEN " '
2: 0.02 #GRBL, CTLx$ '
6: 0.05 #GRBL, "$$" ' request params
2: 0.02 open DefaultDir$;"\GUI-INI.ini" for input as #MAC '
4: 0.03 #main.GCwindow, "GcodeDir$ = ";GcodeDir$ '
2: 0.02 #main.GCwindow, "EditPath$ = ";EditPath$ '
4: 0.03 #main.GCwindow, "GUI-1Line-[Mac";x;"] = "; Macro$(x) '
8: 0.06 #main.GCwindow, "<";x;"> ";MP1$(x) '
2: 0.02 #main.GCwindow, "<";x;"> ";MP2$(x) '
2: 0.02 #main.GCwindow, "<";x;"> ";MP3$(x) '
2: 0.02 #main.GCwindow, "<";x;"> ";MP4$(x) '

426: 3.35 (Unaccounted for)


Re: LBB runs 7 times slower than LB on my GBRL-Sen
Post by xtal on Dec 25th, 2017, 12:47pm

Running Slow profile Program terminates after 3rd tic msg

Profiler report for C:\Users\msw10\AppData\Roaming\Liberty BASIC Pro v4.5.1\GRBL-NU5DggmZ10h-lbb-100.bas

Mon. 25 Dec 2017, 07:36:08

Figures in the first column indicate approximate
time in milliseconds spent in each program line.

Figures in the second column indicate approximate
percentage of the time spent in each program line.

Time spent profiling: 93.978 seconds.

78: 0.08 '** Liberty BASIC 4.51 pro - 3/14/2017 GCode Sender using GRBL 1.1F Program with simple Graphics
8: 0.01 Menu #main, "DROreset", "Reset MPX", [ZX], "Reset MPY", [MZY], "Reset MPZ", [MZZ], "ResetALL", [MZR]
6: 0.01 Menu #main, "HELP", "Q/A.txt", [HELPx],"LibertyBasic.chm",[HELPchm],"LB-Forum",[HELPforum]
2: button #main.JXFe,"--",[JXFe],UL,5,624,14,13 ' - 1
6: 0.01 texteditor #main.WinStatus, 55,125, 420, 80 ' LBB adjust ' Top left Corner - over, down
2: texteditor #main.GCwindow, 55, 210, 420, 260 ' LBB adjust ' bottom right - width, down
2: bmpbutton #main.EMRRESET, BMPdir$;"estop6.bmp",[ESTOP],UL, 188,575 ' EM STOP / CLOSE
2: button #main.rtz, "RTNZERO", [Ret2ZERO], UL, 375, 600, 60, 30 '
2: button #main.mac10, "MP_1", [macP1], UL, 445, 25, 40, 20 ' "G21G90G0Z-26X-230Y-188"
2: statictext #main.nbrfilename, "#File's",570,70,30,14 '
2: listbox #main.S2, SB$(),[Prm2],580,125,102,108 '
2: texteditor #main.PopUp, 500, 250, 475,350 '
1116: 1.19 Open "Liberty Basic GRBL GUI" for Window as #main '
6: 0.01 #main.Status "setfocus" 'MUST setfocus to graphicbox '
12: 0.01 #main "font ms_sans_serif 8" ' was 10 slightly to big
286: 0.30 #main.Status, "font arial 24"
2: #main.DROWCx, "!font arial 14" ' Digital Read Out font size 14
2: #main.DROWCy, "!font arial 14"
2: #main.DROWCz, "!font arial 14"
2: #main.DROMPx, "!font arial 14"
2: #main.DROMPy, "!font arial 14"
6: 0.01 #main.DROMPz, "!font arial 14"
2: #main.DROWPx, "!font arial 14"
2: #main.DROWPy, "!font arial 14"
2: #main.DROWPz, "!font arial 14"
2: #main.green,"!font roman 6 10" '
2: #main.yellow,"Folder" '
2: #main.green,"File" '
2: #main.selbox2, "hide" ' hide this box
2: #main.Filebox,"fill green" '
2: #main.JX, str$(JXvar) : #main.JY, str$(JYvar) : #main.JZ, str$(JZvar)
4: #main.JXF, "F";str$(JXFvar) : #main.JYF,"F";str$(JYFvar) : #main.JZF,"F";str$(JZFvar)
2: magnify=1 : #main.Mag1,1 ' show magnifer value
2: plotxy=2 : #main.PLOTa,"TL" '
2: #main.GCwindow, "TotalScreen Height = "; DisplayHeight '
2: call GetMacros ' load macros from GUI-INI.ini
2: if len(P$)>0 then #main.Comx, P$ '
2: if len(BaudRate$)>0 then #main.Baud, BaudRate$ '
6: 0.01 timer bucketdelay, [ckbuf] ' every 15 ms ckbuf
83048: 88.37 wait '
2: #main.GCwindow, Xtime$ '
204: 0.22 #GRBL, "?"; '' Keep semicolen so ok-ok won't display approx 100 ms interval not sure how semicolen does this
8: 0.01 lastsent=time$("ms") '
4: comlof=lof(#GRBL) ' lof >1 data is in buffer
58: 0.06 if comlof>= 1 then GRBLin$ = GRBLin$ + input$(#GRBL,comlof) ' save comm data to GRCLin$
2: win$=left$(GRBLin$,crlfPos+1) ' extract this line
8: 0.01 timer 0 ' stop timer until line processed *****
16: 0.02 #main.GCwindow, win$ ' print response in response window
116: 0.12 #main.WinStatus, "<";Qcnt;"> ";win$ ' print <~~~~~~~> msg in status window
4: #GRBL, "M5" ' ensure spindle off
34: 0.04 Q=DelayMS(500) ' wait 1/2 second
2: #GRBL, CTLx$; ' send soft reset
26: 0.03 Q=DelayMS(500) ' wait 1/2 second
2: close #GRBL ' comm port
34: 0.04 close #main ' main window
7028: 7.48 END ' must stop main here
2: #main.DROWCx, WCX ' update WCOx
2: #main.DROWCy, WCY ' update WCOy
2: #main.DROWCz, WCZ ' update WCOz
2: #main.DROMPx, MPX ' load MPOSx
2: #main.DROMPy, MPY ' load MPOSy
2: #main.DROWPx, MPX - WCX ' load WPOSx
2: #main.DROWPy, MPY - WCY ' load WPOSy
2: #main.DROWPz, MPZ - WCZ ' load WPOSy
926: 0.99 while time$("milliseconds") < td '
12: 0.01 wend '
2: #main.Status, "fill ";color$ ' fill yellow
8: 0.01 #main.Status, "\"grinata$ ' print data
46: 0.05 #main.GCwindow, "CommPort <"laugh;"> checked at ";time$() '
104: 0.11 open "Com";str$(p);":115200,n,8,1" for random as #com ' use this for LBB
4: close #com '
34: 0.04 #main.CommPort, "reload" '
2: #main.Baudrate, "!" ' clr listbox 'BaudRate$
2: #main.CommPort, "!" ' clr listbox 'laugh$
8: 0.01 open P$;":";BaudRate$;",n,8,1" for random as #GRBL ' LBB
2: #main.Baudrate, "!";BaudRate$ ' combo select box
2: #main.CommPort, "!"laugh$ ' combo select box
2: #main.Comx, P$ ' testbox
2: #main.Baud, BaudRate$ ' test box
4: #main.GCwindow, P$;" WAS / IS OPEN " '
2: #GRBL, CTLx$ '
4: #GRBL, "$$" ' request params
2: #main.GCwindow, "GcodeDir$ = ";GcodeDir$ '
2: #main.GCwindow, "EditPath$ = ";EditPath$ '
2: #main.GCwindow, "GUI-1Line-[Mac";x;"] = "; Macro$(x) '
6: 0.01 #main.GCwindow, "<";x;"> ";MP1$(x) '
2: #main.GCwindow, "<";x;"> ";MP2$(x) '
2: #main.GCwindow, "<";x;"> ";MP3$(x) '
2: #main.GCwindow, "<";x;"> ";MP4$(x) '
562: 0.60 (Unaccounted for)
ENDEND

Re: LBB runs 7 times slower than LB on my GBRL-Sen
Post by Richard Russell on Dec 25th, 2017, 1:32pm

on Dec 25th, 2017, 12:45pm, xtal wrote:
4: 0.03 timer bucketdelay, [ckbuf] ' every 15 ms ckbuf
2: 0.02 #main.GCwindow, Xtime$ '

Where has the WAIT statement gone? Have you deleted it from your program so that it runs fast? Or have you deleted it from the profiler report because it reported zero time?

Also, where has the OPEN statement gone? In the so-called 'slow' program it takes about a second to open the #main window but in the 'fast' report the line is missing entirely.

Do you realise that your program won't be working the same as in LB 4 because of item 12 in the Compatibility docs: "Opening a file in BINARY mode does not prevent PRINT outputting a newline (CRLF)"? Your code does open the COM port in binary mode so you probably need to add a semicolon to each PRINT.

Richard.

Re: LBB runs 7 times slower than LB on my GBRL-Sen
Post by xtal on Dec 25th, 2017, 1:57pm

2: 0.02 #main.GCwindow, Xtime$

the quit was right after this probably need delay......

-- my edit pgm must have screwed up ?
0: [LoopExit] ' wait for user input
4: 0.03 timer bucketdelay, [ckbuf] ' every 15 ms ckbuf
5510: 43.30 wait '
0:



could not having enough memory allocated [something like swapspace] be causing this? Just a thought...
Re: LBB runs 7 times slower than LB on my GBRL-Sen
Post by xtal on Dec 25th, 2017, 2:24pm

corrected FAST profiler

Profiler report for C:\Users\msw10\AppData\Roaming\Liberty BASIC Pro v4.5.1\GRBL-NU5DggmZ10h-lbb-100.bas

Mon. 25 Dec 2017, 07:37:00

Figures in the first column indicate approximate
time in milliseconds spent in each program line.

Figures in the second column indicate approximate
percentage of the time spent in each program line.

Time spent profiling: 12.726 seconds.

86: 0.68 '** Liberty BASIC 4.51 pro - 3/14/2017 GCode Sender using GRBL 1.1F Program with simple Graphics
8: 0.06 Menu #main, "DROreset", "Reset MPX", [ZX], "Reset MPY", [MZY], "Reset MPZ", [MZZ], "ResetALL", [MZR]
6: 0.05 Menu #main, "HELP", "Q/A.txt", [HELPx],"LibertyBasic.chm",[HELPchm],"LB-Forum",[HELPforum]
10: 0.08 Menu #main, "DEBUG","--NA1--",[XBUG1],"--NA2--",[XBUG2],"DLY15/35",[DLY32],"DLY25/45",[DLY48],"DLY55/75",[DLY64],"DLY70/90",[DLY80],"DLY85/105",[DLY96]
2: 0.02 button #main.Pause, "Pause", [PAUSE], UL, 5, 450, 45, 20
2: 0.02 button #main.JZMd,"--",[JZMd],UL,158,549,12,13 '
6: 0.05 texteditor #main.WinStatus, 55,125, 420, 80 ' LBB adjust ' Top left Corner - over, down
2: 0.02 texteditor #main.GCwindow, 55, 210, 420, 260 ' LBB adjust ' bottom right - width, down
4: 0.03 bmpbutton #main.EMRRESET, BMPdir$;"estop6.bmp",[ESTOP],UL, 188,575 ' EM STOP / CLOSE
2: 0.02 button #main.mac7, "Mac7", [mac7], UL, 728, 0, 40, 20
2: 0.02 button #main.EditGcode, "Edt GCode", [EditCode], UL, 940,104, 62, 20
2: 0.02 textbox #main.DROMPx, 55, 0, 110, 30 ' Right Justify & TextboxColor$ = "White"
2: 0.02 texteditor #main.PopUp, 500, 250, 475,350 '
1160: 9.12 Open "Liberty Basic GRBL GUI" for Window as #main '
4: 0.03 #main.Status "setfocus" 'MUST setfocus to graphicbox '
14: 0.11 #main "font ms_sans_serif 8" ' was 10 slightly to big
296: 2.33 #main.Status, "font arial 24"
2: 0.02 #main.DROWCx, "!font arial 14" ' Digital Read Out font size 14
2: 0.02 #main.DROWCy, "!font arial 14"
4: 0.03 #main.DROMPx, "!font arial 14"
2: 0.02 #main.DROMPy, "!font arial 14"
6: 0.05 #main.DROMPz, "!font arial 14"
2: 0.02 #main.DROWPx, "!font arial 14"
2: 0.02 #main.DROWPy, "!font arial 14"
2: 0.02 #main.DROWPz, "!font arial 14"
2: 0.02 #main.green,"!font roman 6 10" '
2: 0.02 #main.yellow,"Folder" '
2: 0.02 #main.green,"File" '
2: 0.02 #main.PopUp, "!hide" '
2: 0.02 #main.Filebox,"fill green" '
2: 0.02 #main.JX, str$(JXvar) : #main.JY, str$(JYvar) : #main.JZ, str$(JZvar)
4: 0.03 #main.JXF, "F";str$(JXFvar) : #main.JYF,"F";str$(JYFvar) : #main.JZF,"F";str$(JZFvar)
2: 0.02 magnify=1 : #main.Mag1,1 ' show magnifer value
2: 0.02 if len(P$)>0 then #main.Comx, P$ '
2: 0.02 if len(BaudRate$)>0 then #main.Baud, BaudRate$ '
2: 0.02 call GetCommPorts ' scan & load com#'s array
4: 0.03 timer bucketdelay, [ckbuf] ' every 15 ms ckbuf
5510: 43.30 wait '
2: 0.02 #main.GCwindow, Xtime$ '
116: 0.91 #GRBL, "?"; '' Keep semicolen so ok-ok won't display approx 100 ms interval not sure how semicolen does this
20: 0.16 lastsent=time$("ms") '
10: 0.08 #main.Dly1, int((AvgTime/25)+.5) '
6: 0.05 comlof=lof(#GRBL) ' lof >1 data is in buffer
10: 0.08 if comlof>= 1 then GRBLin$ = GRBLin$ + input$(#GRBL,comlof) ' save comm data to GRCLin$
4: 0.03 timer 0 ' stop timer until line processed *****
2: 0.02 Ze=instr(WIN$,"|",2) : winswitch = 1 ' <Idle|MPos
10: 0.08 #main.GCwindow, win$ ' print response in response window
70: 0.55 #main.WinStatus, "<";Qcnt;"> ";win$ ' print <~~~~~~~> msg in status window
4: 0.03 #GRBL, "M5" ' ensure spindle off
26: 0.20 Q=DelayMS(500) ' wait 1/2 second
2: 0.02 #GRBL, CTLx$; ' send soft reset
32: 0.25 Q=DelayMS(500) ' wait 1/2 second
2: 0.02 close #GRBL ' comm port
30: 0.24 close #main ' main window
3564: 28.01 END ' must stop main here
2: 0.02 #main.DROWCx, WCX ' update WCOx
2: 0.02 #main.DROWCy, WCY ' update WCOy
2: 0.02 #main.DROWCz, WCZ ' update WCOz
2: 0.02 #main.DROMPy, MPY ' load MPOSy
2: 0.02 #main.DROMPz, MPZ ' load MPOSz
2: 0.02 #main.DROWPx, MPX - WCX ' load WPOSx
2: 0.02 #main.DROWPy, MPY - WCY ' load WPOSy
2: 0.02 #main.DROWPz, MPZ - WCZ ' load WPOSy
918: 7.21 while time$("milliseconds") < td '
22: 0.17 wend '
10: 0.08 #main.Status, "\";data$ ' print data
70: 0.55 #main.GCwindow, "CommPort <";p;"> checked at ";time$() '
92: 0.72 open "Com";str$(p);":115200,n,8,1" for random as #com ' use this for LBB
4: 0.03 close #com '
36: 0.28 #main.CommPort, "reload" '
2: 0.02 #main.Baudrate, "!" ' clr listbox 'BaudRate$
2: 0.02 #main.CommPort, "!" ' clr listbox ';P$
8: 0.06 open P$;":";BaudRate$;",n,8,1" for random as #GRBL ' LBB
2: 0.02 #main.CommPort, "!";P$ ' combo select box
2: 0.02 #main.Comx, P$ ' testbox
2: 0.02 #main.Baud, BaudRate$ ' test box
2: 0.02 #main.GCwindow, P$;" WAS / IS OPEN " '
2: 0.02 #GRBL, CTLx$ '
6: 0.05 #GRBL, "$$" ' request params
2: 0.02 open DefaultDir$;"\GUI-INI.ini" for input as #MAC '
4: 0.03 #main.GCwindow, "GcodeDir$ = ";GcodeDir$ '
2: 0.02 #main.GCwindow, "EditPath$ = ";EditPath$ '
4: 0.03 #main.GCwindow, "GUI-1Line-[Mac";x;"] = "; Macro$(x) '
8: 0.06 #main.GCwindow, "<";x;"> ";MP1$(x) '
2: 0.02 #main.GCwindow, "<";x;"> ";MP2$(x) '
2: 0.02 #main.GCwindow, "<";x;"> ";MP3$(x) '
2: 0.02 #main.GCwindow, "<";x;"> ";MP4$(x) '

426: 3.35 (Unaccounted for)


Re: LBB runs 7 times slower than LB on my GBRL-Sen
Post by xtal on Dec 25th, 2017, 2:31pm

corrected slow profiler

Profiler report for C:\Users\msw10\AppData\Roaming\Liberty BASIC Pro v4.5.1\GRBL-NU5DggmZ10h-lbb-100.bas

Mon. 25 Dec 2017, 07:36:08

Figures in the first column indicate approximate
time in milliseconds spent in each program line.

Figures in the second column indicate approximate
percentage of the time spent in each program line.

Time spent profiling: 93.978 seconds.

78: 0.08 '** Liberty BASIC 4.51 pro - 3/14/2017 GCode Sender using GRBL 1.1F Program with simple Graphics
8: 0.01 Menu #main, "DROreset", "Reset MPX", [ZX], "Reset MPY", [MZY], "Reset MPZ", [MZZ], "ResetALL", [MZR]
6: 0.01 Menu #main, "HELP", "Q/A.txt", [HELPx],"LibertyBasic.chm",[HELPchm],"LB-Forum",[HELPforum]
10: 0.01 Menu #main, "DEBUG","--NA1--",[XBUG1],"--NA2--",[XBUG2],"DLY15/35",[DLY32],"DLY25/45",[DLY48],"DLY55/75",[DLY64],"DLY70/90",[DLY80],"DLY85/105",[DLY96]
2: button #main.JXFe,"--",[JXFe],UL,5,624,14,13 ' - 1
6: 0.01 texteditor #main.WinStatus, 55,125, 420, 80 ' LBB adjust ' Top left Corner - over, down
2: texteditor #main.GCwindow, 55, 210, 420, 260 ' LBB adjust ' bottom right - width, down
2: bmpbutton #main.EMRRESET, BMPdir$;"estop6.bmp",[ESTOP],UL, 188,575 ' EM STOP / CLOSE
2: button #main.rtz, "RTNZERO", [Ret2ZERO], UL, 375, 600, 60, 30 '
2: button #main.mac10, "MP_1", [macP1], UL, 445, 25, 40, 20 ' "G21G90G0Z-26X-230Y-188"
2: statictext #main.nbrfilename, "#File's",570,70,30,14 '
2: listbox #main.S2, SB$(),[Prm2],580,125,102,108 '
2: texteditor #main.PopUp, 500, 250, 475,350 '
1116: 1.19 Open "Liberty Basic GRBL GUI" for Window as #main '
6: 0.01 #main.Status "setfocus" 'MUST setfocus to graphicbox '
12: 0.01 #main "font ms_sans_serif 8" ' was 10 slightly to big
286: 0.30 #main.Status, "font arial 24"
2: #main.DROWCx, "!font arial 14" ' Digital Read Out font size 14
2: #main.DROWCy, "!font arial 14"
2: #main.DROWCz, "!font arial 14"
2: #main.DROMPx, "!font arial 14"
2: #main.DROMPy, "!font arial 14"
6: 0.01 #main.DROMPz, "!font arial 14"
2: #main.DROWPx, "!font arial 14"
2: #main.DROWPy, "!font arial 14"
2: #main.DROWPz, "!font arial 14"
2: #main.green,"!font roman 6 10" '
2: #main.yellow,"Folder" '
2: #main.green,"File" '
2: #main.selbox2, "hide" ' hide this box
2: #main.Filebox,"fill green" '
2: #main.JX, str$(JXvar) : #main.JY, str$(JYvar) : #main.JZ, str$(JZvar)
4: #main.JXF, "F";str$(JXFvar) : #main.JYF,"F";str$(JYFvar) : #main.JZF,"F";str$(JZFvar)
2: magnify=1 : #main.Mag1,1 ' show magnifer value
2: plotxy=2 : #main.PLOTa,"TL" '
2: #main.GCwindow, "TotalScreen Height = "; DisplayHeight '
2: call GetMacros ' load macros from GUI-INI.ini
2: if len(P$)>0 then #main.Comx, P$ '
2: if len(BaudRate$)>0 then #main.Baud, BaudRate$ '
6: 0.01 timer bucketdelay, [ckbuf] ' every 15 ms ckbuf
83048: 88.37 wait '
2: #main.GCwindow, Xtime$ '
204: 0.22 #GRBL, "?"; '' Keep semicolen so ok-ok won't display approx 100 ms interval not sure how semicolen does this
8: 0.01 lastsent=time$("ms") '
20: 0.02 #main.Dly1, int((AvgTime/25)+.5) '
4: comlof=lof(#GRBL) ' lof >1 data is in buffer
58: 0.06 if comlof>= 1 then GRBLin$ = GRBLin$ + input$(#GRBL,comlof) ' save comm data to GRCLin$
2: win$=left$(GRBLin$,crlfPos+1) ' extract this line
8: 0.01 timer 0 ' stop timer until line processed *****
16: 0.02 #main.GCwindow, win$ ' print response in response window
116: 0.12 #main.WinStatus, "<";Qcnt;"> ";win$ ' print <~~~~~~~> msg in status window
4: #GRBL, "M5" ' ensure spindle off
34: 0.04 Q=DelayMS(500) ' wait 1/2 second
2: #GRBL, CTLx$; ' send soft reset
26: 0.03 Q=DelayMS(500) ' wait 1/2 second
2: close #GRBL ' comm port
34: 0.04 close #main ' main window
7028: 7.48 END ' must stop main here
2: #main.DROWCx, WCX ' update WCOx
2: #main.DROWCy, WCY ' update WCOy
2: #main.DROWCz, WCZ ' update WCOz
2: #main.DROMPx, MPX ' load MPOSx
2: #main.DROMPy, MPY ' load MPOSy
2: #main.DROWPx, MPX - WCX ' load WPOSx
2: #main.DROWPy, MPY - WCY ' load WPOSy
2: #main.DROWPz, MPZ - WCZ ' load WPOSy
926: 0.99 while time$("milliseconds") < td '
12: 0.01 wend '
2: #main.Status, "fill ";color$ ' fill yellow
8: 0.01 #main.Status, "\";data$ ' print data
46: 0.05 #main.GCwindow, "CommPort <";p;"> checked at ";time$() '
104: 0.11 open "Com";str$(p);":115200,n,8,1" for random as #com ' use this for LBB
4: close #com '
34: 0.04 #main.CommPort, "reload" '
2: #main.Baudrate, "!" ' clr listbox 'BaudRate$
2: #main.CommPort, "!" ' clr listbox ';P$
8: 0.01 open P$;":";BaudRate$;",n,8,1" for random as #GRBL ' LBB
2: #main.Baudrate, "!";BaudRate$ ' combo select box
2: #main.CommPort, "!";P$ ' combo select box
2: #main.Comx, P$ ' testbox
2: #main.Baud, BaudRate$ ' test box
4: #main.GCwindow, P$;" WAS / IS OPEN " '
2: #GRBL, CTLx$ '
4: #GRBL, "$$" ' request params
2: #main.GCwindow, "GcodeDir$ = ";GcodeDir$ '
2: #main.GCwindow, "EditPath$ = ";EditPath$ '
2: #main.GCwindow, "GUI-1Line-[Mac";x;"] = "; Macro$(x) '
6: 0.01 #main.GCwindow, "<";x;"> ";MP1$(x) '
2: #main.GCwindow, "<";x;"> ";MP2$(x) '
2: #main.GCwindow, "<";x;"> ";MP3$(x) '
2: #main.GCwindow, "<";x;"> ";MP4$(x) '
562: 0.60 (Unaccounted for)

Re: LBB runs 7 times slower than LB on my GBRL-Sen
Post by xtal on Dec 25th, 2017, 11:22pm

this is part1 of form

[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

Re: LBB runs 7 times slower than LB on my GBRL-Sen
Post by xtal on Dec 25th, 2017, 11:27pm

This is part 2 of form + code
this code runs 3 100 counts then terminates for testing

normally the count is 1776 approx 30 seconds

The TIC value is displayed after each 100 count
Run program do nothing else program runs slow
Run program then immediately click the print window
program runs fast..........
running on w10 pro , but suspect same may happen on Wxp

I think that if a lot of buttons + other is deleted it will run ok



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,102,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,500,87,72,17
button      #main.yellow,"Folder", comboClick,UL,513,89,45,12
graphicbox  #main.Filebox,573,87,72,17
button      #main.green,"File",comboClick,UL,586,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

Open "Liberty Basic GRBL GUI" for Window as #main
#main "trapclose [quit]"
oldtime=time$("ms")
etime=0 : lastsent=0
bucketdelay=15
[LoadMacros]
[Glog]
[ErrLoop1]
[LoopExit]
timer bucketdelay, [ckbuf]
wait
[ckbuf]
nowtime=time$("ms")
Qcnt=Qcnt+1
if Qcnt >99 then
x$=time$()
elapsedtime=(nowtime-oldtime)/1000
oldtime=time$("ms")
etime=etime+elapsedtime
mstime=int((etime/100)*10000)/10
Xtime$="<";x$;">  <";Qcnt;">  <";etime;"sec>  <";mstime;"msTIC";">"
#main.GCwindow, Xtime$ 
print Xtime$ 
abc=abc+1
end if
if abc=3 then [quit]
if CommOpen=0 then [LoopExit]
[getbuffer]
[getmessage]
[loopx]
[PreProcess]
[StepWait]
[PrintResponse]
goto [LoopExit]
[ESTOP]
[quit]
close #main
END


 

Re: LBB runs 7 times slower than LB on my GBRL-Sen
Post by xtal on Dec 25th, 2017, 11:56pm



After deleteing different combinations of buttons etc ,, the TIC value speeds up , but I think it's just because FORM OVERHEAD is being removed.

removing all except MENU and
texteditor #main.WinStatus, 55,125, 420, 80
texteditor #main.GCwindow, 55, 210, 420, 260
Will give 15+ TIC value then
adding 7 buttons TIC is 18+
adding 7 graphicboxes TIC is 20+
adding 5 listboxes TIC 15-16
adding 7 text boxes TIC 19+
adding 7 comboboxes TIC 17-18
adding 7 statictext TIC 18+
adding 7 style bits TIC 15+

It appears to me that the more you add to the form the more you increase the TIC value unless the print window is selected...




Re: LBB runs 7 times slower than LB on my GBRL-Sen
Post by Richard Russell on Dec 26th, 2017, 10:20am

on Dec 25th, 2017, 11:27pm, xtal wrote:
Run program do nothing else program runs slow

Results here, after commenting-out reference to non-existent bitmap (line 110):

Windows 10 laptop:
<11:16:11> <100> <1.562sec> <15.6msTIC>
<11:16:11> <101> <1.579sec> <15.7msTIC>
<11:16:11> <102> <1.596sec> <15.9msTIC>

Windows 10 desktop:
<11:27:28> <100> <1.612sec> <16.1msTIC>
<11:27:28> <101> <1.626sec> <16.2msTIC>
<11:27:28> <102> <1.641sec> <16.4msTIC>

Windows 7 desktop:
<11:38:11> <100> <1.611sec> <16.1msTIC>
<11:38:11> <101> <1.629sec> <16.2msTIC>
<11:38:11> <102> <1.646sec> <16.4msTIC>

Windows XP desktop:
<11:37:37> <100> <2.015sec> <20.1msTIC>
<11:37:37> <101> <2.031sec> <20.3msTIC>
<11:37:37> <102> <2.062sec> <20.6msTIC>

Windows 2000 laptop:
<21:45:20> <100> <2.003sec> <20msTIC>
<21:45:20> <101> <2.023sec> <20.2msTIC>
<21:45:20> <102> <2.043sec> <20.4msTIC>

It's very rare that I get to fire up my Windows 2000 machine for testing, but it's pleasing to see that it still works well (LBB 3.04, the others are all up-to-date); note that its clock is not set - battery long since dead!

What are other people getting with the OP's latest program (to copy LBB's mainwin to the clipboard type Ctrl+Tab)?

Richard.

Re: LBB runs 7 times slower than LB on my GBRL-Sen
Post by tsh73 on Dec 26th, 2017, 12:03pm

Win XP desktop
<15:59:22> <100> <1.563sec> <15.6msTIC>
<15:59:22> <101> <1.578sec> <15.7msTIC>
<15:59:22> <102> <1.594sec> <15.9msTIC>

Re: LBB runs 7 times slower than LB on my GBRL-Sen
Post by xtal on Dec 26th, 2017, 1:56pm

Interesting, I find little difference with or without BMP , and I do have the BMP...

My 2 core W10 pro
with bmp approx 464ms
without bmp approx 470 ms
select print window = very big decrease

4 core - main unit W10 pro
with bmp approx 469ms
without bmp approx 266 ms
select print window = very big decrease

4 core - adam W10 pro
with bmp approx 21ms
without bmp approx 20 ms
select print window = can't select fast enough to test

6 core - mike W10 pro
with bmp approx 26.5ms
without bmp approx 26.5 ms
select print window = 16.4 lucky select

Win XP laptop
with bmp approx 75ms
without bmp approx 83 ms
select print window = can't select fast enough to test

Win 2000 server laptop
with bmp approx 21ms
without bmp approx 20 ms
select print window = can't select fast enough to test

Richard it would be interesting to see what results you get with LB4 pro 4.5.1

If I increase the 100 loop counts from 3 to 30 it looks like the TIC value slowly grows on both Lb and LBB?

The following code give you 5 seconds to select the print window..
I still don't know WHY the slow tic growth


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

td = time$("milliseconds") +5000     ' delay 5 seconds to allow move window
while time$("milliseconds") < td                                '
wend
                                                          '
etime=0 : lastsent=0
bucketdelay=15
oldtime=time$("ms")
[LoadMacros]
[Glog]
[ErrLoop1]
[LoopExit]
timer bucketdelay, [ckbuf]
wait
[ckbuf]
nowtime=time$("ms")
x$=time$()
elapsedtime=(nowtime-oldtime)/1000
oldtime=nowtime
etime=etime+elapsedtime
mstime=int((etime/100)*10000)/10

Qcnt=Qcnt+1
if Qcnt >99 then
 Xtime$="<";x$;">  <";Qcnt;">  <";etime;"sec>  <";mstime;"msTIC";">"
 #main.GCwindow, Xtime$ 
 print Xtime$ 
 abc=abc+1
end if
if abc=5 then [quit]
if CommOpen=0 then [LoopExit]
[getbuffer]
[getmessage]
[loopx]
[PreProcess]
[StepWait]
[PrintResponse]
goto [LoopExit]
[ESTOP]
[quit]
close #main
END

 


Re: LBB runs 7 times slower than LB on my GBRL-Sen
Post by Richard Russell on Dec 26th, 2017, 2:32pm

on Dec 26th, 2017, 1:56pm, xtal wrote:
If I increase the 100 loop counts fro 3 to 30 it looks like the TIC value slowly grows ?

I'm not too sure what 'TIC' stands for, but your program is measuring the time taken for 100, 101, 102, 103... etc. timer 'ticks' so of course the value grows! By the time you are measuring 200 ticks the value is doubled.

Perhaps your calculation isn't what you intended it to be. To stop the final printed value growing you would need to change this line:

Code:
mstime=int((etime/100)*10000)/10 

to this:

Code:
mstime=int((etime/Qcnt)*10000)/10 

so that it divides the total elapsed time (etime) by the total number of timer ticks (Qcnt).

All my tests, and Anatoly's, confirm that LBB is working correctly. There is no trace of any 'slow down' even on the slowest PCs (and my Windows 2000 laptop is very slow). If you are getting different results you need to be looking locally for the cause.

Richard.

Re: LBB runs 7 times slower than LB on my GBRL-Sen
Post by tsh73 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.
Re: LBB runs 7 times slower than LB on my GBRL-Sen
Post by Richard Russell 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.
Re: LBB runs 7 times slower than LB on my GBRL-Sen
Post by tsh73 on Dec 26th, 2017, 8:14pm

>>I would expect that if you set bucketdelay=20 you will get 32 ms consistently.
Yes, 31-32
Re: LBB runs 7 times slower than LB on my GBRL-Sen
Post by xtal 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.
Re: LBB runs 7 times slower than LB on my GBRL-Sen
Post by Richard Russell 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.

Re: LBB runs 7 times slower than LB on my GBRL-Sen
Post by Rod 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.


Re: LBB runs 7 times slower than LB on my GBRL-Sen
Post by Richard Russell 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.

Re: LBB runs 7 times slower than LB on my GBRL-Sen
Post by xtal 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
 

Re: LBB runs 7 times slower than LB on my GBRL-Sen
Post by xtal 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...
Re: LBB runs 7 times slower than LB on my GBRL-Sen
Post by Richard Russell 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.


Re: LBB runs 7 times slower than LB on my GBRL-Sen
Post by Rod 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?

Re: LBB runs 7 times slower than LB on my GBRL-Sen
Post by Richard Russell 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.
Re: LBB runs 7 times slower than LB on my GBRL-Sen
Post by xtal 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 ????




Re: LBB runs 7 times slower than LB on my GBRL-Sen
Post by Richard Russell 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.
Re: LBB runs 7 times slower than LB on my GBRL-Sen
Post by xtal 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---

 


Re: LBB runs 7 times slower than LB on my GBRL-Sen
Post by Richard Russell on Dec 28th, 2017, 5:52pm

on Dec 28th, 2017, 5:13pm, xtal wrote:
Is there any way to pop the return off the stack?

Not too sure what you mean. What are you trying to achieve?

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

By "bounce" do you mean 'jitter'? Jitter of that order is entirely to be expected.

If you are wanting LBB to behave identically to LB you are going to be disappointed. Indeed your other problems (font issues and 'non-displaying' textboxes) are caused by you making insufficient allowance for predictable variations between platforms, and you would likely see similar 'failures' if you ran your program in LB but under Wine rather than Windows. Even a different version of Windows or a different 'theme' setting might be sufficient. Modifying your code so that it works in LBB as well as LB will make it generally more reliable! grin

Can we draw this thread to a close now?

Richard.

Re: LBB runs 7 times slower than LB on my GBRL-Sen
Post by Richard Russell on Dec 28th, 2017, 6:01pm

I have locked this thread because the original reported issue ("LBB runs 7 times slower than LB") has been resolved. Other issues are best raised in a new thread.

Richard.