Page 2 of 3
Re: C language and Xbase
Posted: Mon Oct 26, 2015 6:20 am
by rdonnay
C++ code : 6 seconds
Alaska code first example without optimalization byte to byte read from file : 3minutes and 13 seconds
Alaska code optimalized full file read to variable string and so write variable to file once: 18 seconds
I would consider this a success.
Alaska code that is only 3 times slower than C code is remarkable.
This is one of the things I like about Xbase++.
There is a lot of processing going on when building and processing a large eXpress++ GetList.
Performance is a key factor to a successful SGL architecture and is why eXpress++ can do the job.
Re: C language and Xbase
Posted: Mon Oct 26, 2015 7:11 am
by Victorio
ok, thanks all for tips and help.
now I must reprogramming every utilities in C++ and implement it to main application with Gui.
After it I will see how program work.
I like Ca Clipper also for his power in comparing with FoxPro.
Now I like Xbase too
![Smile :)](./images/smilies/icon/smile.gif)
I am sure , that Alaska Xbase and eXpress is performance tool with many many options, but I now only discovering what can do with this tool.
Before one year I do not know how make "Hello word" with it.
Victorio
Re: C language and Xbase
Posted: Mon Oct 26, 2015 7:28 am
by rdonnay
Before one year I do not know how make "Hello word" with it.
Code: Select all
#include "dcdialog.ch"
FUNCTION Main()
LOCAL GetList[0]
@ 0,0 DCSAY 'Hello World!" SAYSIZE 0 FONT '24.Arial Bold'
DCREAD GUI TITLE 'Hello' FIT
RETURN nil
Re: C language and Xbase
Posted: Mon Oct 26, 2015 7:43 am
by Victorio
OK
![Very Happy :D](./images/smilies/icon/biggrin.gif)
I bought Alaska Xbase and eXpress in december 2014 ... and first running exe was my holiday
![Razz :P](./images/smilies/icon/razz.gif)
Re: C language and Xbase
Posted: Mon Oct 26, 2015 8:20 am
by rdonnay
OK
![Very Happy :D](./images/smilies/icon/biggrin.gif)
I bought Alaska Xbase and eXpress in december 2014 ... and first running exe was my holiday
![Razz :P](./images/smilies/icon/razz.gif)
Victorio -
I know that you are an eXpress++ user.
I posted the Hello World sample for those who have still not got started with Xbase++.
Roger
Re: C language and Xbase
Posted: Mon Oct 26, 2015 10:00 pm
by TWolfe
It appears that 'j' is just a counter. Try:
If this code is executed a million times or so it may save you another second depending on your machine speed.
HTH,
Terry
Re: C language and Xbase
Posted: Tue Oct 27, 2015 2:39 am
by Victorio
Hi Terry,
Super, one mathematical operation (-1) spare save another 5 seconds
![Smile :)](./images/smilies/icon/smile.gif)
Thanks.
Now comparing :
C++code : 6 seconds
Alaska befor change (for j=0 to pomznak-1) : 17 seconds
Alaska after change (for j=1 to pomznak) : 12 seconds
here Xbase is only 2x slower than C.
It is important for me, because I need process about 150GB, then time of one from process will be now 40 hours.
Re: C language and Xbase
Posted: Tue Oct 27, 2015 7:01 am
by rdonnay
Alaska after change (for j=1 to pomznak) : 12 seconds
Make sure that
j and
pomznak are both LOCAL variables.
Re: C language and Xbase
Posted: Tue Oct 27, 2015 7:24 am
by Victorio
yes, both are local
...
Local j, pomznak
...
Re: C language and Xbase
Posted: Tue Oct 27, 2015 9:05 pm
by TWolfe
A couple of more ideas --
Your Code:
Code: Select all
cBuffer=chr(znak)
* zápis znaku do výstupného retazca
cTargetString := cTargetstring+cBuffer
Note: I changed
YOUR -> cTargetString=cTargetstring+cBuffer
TO -> cTargetString := cTargetstring+cBuffer
The ":=" assignment operator is preferred over the ambiguous "=" operator. (The "=" operator can be assignment or comparison depending on context, try to save it for comparisons only. This will save you some nasty debug work in the future.)
Try:
Code: Select all
// cBuffer=chr(znak) <- this is a wasted step
* zápis znaku do výstupného retazca
cTargetString += chr(znak) // <- This saves a duplication of the string in memory
Also note that both the "J:=1 TO pomznak" and "cTargetString += chr(znak)" lines appear twice in your code snip, (change in both places).
This may help,
Terry