[Gambas-user] VB6 to Gambas Global arrays

Ron Onstenk ronstk at ...239...
Mon Jul 17 10:28:08 CEST 2006


On Monday 17 July 2006 04:24, R A Turney wrote:
> I have noticed that the Gambas program is very slow in its computation 
> compared to VB6.  

If you are using the old machine not usable for winXP /Vista by lack 
of speed and memory but still usable with linux then you are right.
But what do you exactly mean with computation?

The CPU executing the bytes in the result file (*.exe) or the calculation of sqr(2).

For the first you are almost right, the CPU must interprete the bytes
from the gambas interpreter (gbi) and that one the bytes from the 'compiled'
gambas file (myprogram.gambas). 

For the second I'm not 100% sure but in general I can say safe there is 
no big difference.

> I am hoping that this is because it is interpreted  instead of compiled. 

Hummm.
Gambas is also compiled. (so the hope is false)
For a *.exe the CPU must also interprete the bytes in memory.
Oeps. that declares why any program is always so slow :)

Compile does only mean 'convert from human readable text a bunch of bytes'
The bytes can be bytes that the CPU interprete or bytes that a 
virtual CPU interprete and that is for gambas code called gbi or gbi2.
The later also known as bytecode or p-code.

Beside of that VB6 is also not 100% CPU executable code (bytes) in the result file.
It uses a mix of bytecode and real CPU bytes and a small interpreter in the
resulting program. 
You have to set a option in the configuration of VB6 to effective change  bytecode to CPU code.

i.e.
using a array of bytes to prepare a call to a dll 
  DD FA (use Function Add(val1,val2) as integer)
  D2 04 (first value 1234)
  2E 16 (second value 5678)

or the code for the dll call with the initialise for that call
  21 04D2 (mov ax 1234)
  E5      (push ax) 
  21 162E (mov ax 5678)
  E5      (push ax)
  CD 12BEFA34 (call 12BEFA34 ;the ADD routine address) 


It needs msvb6vm.dll for the major components as gambas uses several libraries. 
The main library are lib.gb.so and lib.gb.qt.so or lib.gb.gtk.so for gambas

> I don't think I can make an executable in this  version. Is this correct? 
> 
If you mean a 100% direct by the CPU executable/interprete byte array you are correct. 
But a bash script or in msdos a *.bat file are that no executables?
They are totally _not compiled_ at all and still do the job you want. 



Greets,
Ron




More information about the User mailing list