Debug mode
Debug mode
I’m using WinFBE as the IDE for FB. I’ve noticed that when I compile and run my program (huge) in Win64 (Debug) mode and then in Win64 (Release) mode the difference in timing is hardly noticeable (total elapsed time is around 10 minutes in either case). I would have thought array bounds and null pointer checking, etc. would slow things down somewhat. It appears it doesn’t. Unless I’m missing something, I might as well use the debug mode all the time, especially given I am also trapping the errors to spawn a Windows message box to display the details of the error, such line number and error number, before the program crashes. Am I missing something? Any reason why using debugging mode exclusively is a problem?
Re: Debug mode
I don't know what debug mode means, but I assume compilation with -exx.
The speed difference will depend on the program. In the extreme, this 'program' will have similar execution speed with and without the -exx option.
The speed difference will depend on the program. In the extreme, this 'program' will have similar execution speed with and without the -exx option.
Code: Select all
print "wait 10 minutes (or press a key)"
sleep 1000 * 600
Re: Debug mode
Jaskin,
If "total elapsed time is around 10 minutes", then the performance hit from debugging is probably negligible. Can you explain why your program takes so long? What does it do? Did you test where exactly the slow bits are happening?
If "total elapsed time is around 10 minutes", then the performance hit from debugging is probably negligible. Can you explain why your program takes so long? What does it do? Did you test where exactly the slow bits are happening?
-
- Posts: 789
- Joined: Jul 26, 2018 18:28
Re: Debug mode
Debug and release mode are no different, except for the debug data. In debug mode, debug data is written to the EXE, so the EXE will be larger than the release. The array boundaries are checked by the -exx compiler key, as badidea said.
Re: Debug mode
Thanks for the replies. I knew what debug mode does (used it for some 15 years) but always thought it would slow down things. Apparently it doesn't, at least not by much. Size doesn't matter to me. That's good. I can now compile my program (actually a front end to a DLL that emulates a commercial trading application for test purposes) and retain the alerts that might pop up when a problem is encountered in the DLL rather than silently crashing. I use CreateProcess to spawn off another program that uses Windows message box to display a message I transferred to it before the test program or the trading platform I use that calls the same DLL crashes. I'll need to work on the DLL some more so it doesn't crash and instead informs the main app as to what the error is and act accordingly. I also use the message spawning a lot for informational purposes given it's a DLL. As for why it takes so long to run, well it does a lot of number crunching with arrays filled with stock market data, some arrays are static and some dynamic that are expanded as and when required. It takes about 10 minutes for roughly 1 year of 10-minute intraday data. I just speeded it up to 5 minutes by reducing the number of calls to a function (one of many) and instead using shared dim statements and inserting the code from the function directly into the one and only place it will ever be used. BYREFing the parameters didn't help. I did consider using COMMON (reminds me of my old Fortran days :-) but I don't see the need in my case.
Re: Debug mode
Are you talking of a particular IDE with options debug mode / release mode?
WinFBE
-v -g -exx -s gui -x would be debug
-v -s gui -x would be release.
FreeBASIC users are more used to the actual command line options, debug and release mode are a flavour of WinFBE and Dev C++ and various other editors/ides, nothing is mentioned of debug/release in FreeBASIC help, or if it is then please correct me.
Here is WinfBE commandline for dll
-v -s gui -dll -export -x
So no optimisations or array error checking for the dll, and I assume that the dll is doing most of the work (number crunching e.t.c.)
WinFBE
-v -g -exx -s gui -x would be debug
-v -s gui -x would be release.
FreeBASIC users are more used to the actual command line options, debug and release mode are a flavour of WinFBE and Dev C++ and various other editors/ides, nothing is mentioned of debug/release in FreeBASIC help, or if it is then please correct me.
Here is WinfBE commandline for dll
-v -s gui -dll -export -x
So no optimisations or array error checking for the dll, and I assume that the dll is doing most of the work (number crunching e.t.c.)
Re: Debug mode
Just as an afterthought here.
You say that you have a large DATA set.
-gen gcc has a bug inasmuch as it takes a long long time to compile large amounts of DATA from fb DATA in the form:
DATA a,b,c,d,e . . . etc , etc . . .
If you try 32 bit -gen gas then it is almost immediate compile time.
tested with 50000 lines of data strings, of about 100 characters per string.
3 minutes with -gen gcc, 1 second with -gen gas.
Tested also with gas64 (GOOD)
results
You say that you have a large DATA set.
-gen gcc has a bug inasmuch as it takes a long long time to compile large amounts of DATA from fb DATA in the form:
DATA a,b,c,d,e . . . etc , etc . . .
If you try 32 bit -gen gas then it is almost immediate compile time.
tested with 50000 lines of data strings, of about 100 characters per string.
3 minutes with -gen gcc, 1 second with -gen gas.
Tested also with gas64 (GOOD)
results
Code: Select all
compiling . . .
Success ( 179.6163749000989 seconds)
FreeBASIC Compiler - Version 1.07-(08).1 (2020-08-07), built for win64 (64bit)
Copyright (C) 2004-2019 The FreeBASIC development team.
standalone
-gen gcc -Wc -O3
compiling . . .
Success ( 0.9957491001114249 seconds)
FreeBASIC Compiler - Version 1.07-(08).1 (2020-08-07), built for win64 (64bit)
Copyright (C) 2004-2019 The FreeBASIC development team.
standalone
-gen gas64
Re: Debug mode
Yes. I'm using the built-in settings. I used to use FBide where I had to set them manually. WinFBE is so much nicer for many reasons.dodicat wrote:Are you talking of a particular IDE with options debug mode / release mode?
As for using DATA statements - not possible. The amount of data is huge - can run into many MBs. The data is stored in a flat file and I read what I need into an array. Works fine. What slows me down is not the data access but the computations in the DLL. I need a supercomputer!
Re: Debug mode
Maybe you need an assembly routine... what exactly is it doing? What kind of computations?jaskin wrote:What slows me down is not the data access but the computations in the DLL. I need a supercomputer!
Re: Debug mode
I have thought of that. I used to write a lot of MACRO-64 in my younger days. However, it might not make much difference. Anyway, I've almost finished working on a much better approach. Apart from a few custom settings, most of the computations need only be performed once off. So those results are stored in a file on the first run and thereafter each new run just reads them instead of re-computing them. The effect is the program runs in just a few seconds instead of several minutes. This is for just backtestng purposes, not live trading.jj2007 wrote:Maybe you need an assembly routine... what exactly is it doing? What kind of computations?jaskin wrote:What slows me down is not the data access but the computations in the DLL. I need a supercomputer!