Set optimize level using FBide and FBC 1.07.1
Set optimize level using FBide and FBC 1.07.1
How do I do this in FBide? I did "Settings" "Compiler command" appending " -O 3" but that doesn't work.
-
- Posts: 8586
- Joined: May 28, 2005 3:28
- Contact:
Re: Set optimize level using FBide and FBC 1.07.1
FBIDE change all program arguments in lower case so "-O 3" becomes "-o 3" and isn't what you need
but you can use "#cmdline" to give the compiler/linker/assembler arguments directly in your *.bi or *.bas file!
Joshyor something like this:
but you can use "#cmdline" to give the compiler/linker/assembler arguments directly in your *.bi or *.bas file!
Joshy
Code: Select all
#cmdline "-O 3"
print "bla bla bla" : sleep
Code: Select all
#ifndef __FB_64BIT__
#cmdline "-gen gcc -arch pentium4-sse3 -Wc -O3 -fpmode fast -fpu sse -O 3 -asm intel"
#else
#cmdline "-arch x86-64 -Wc -O3 -fpmode fast -fpu sse -O 3 -asm intel"
#endif
' bla bla bla
Re: Set optimize level using FBide and FBC 1.07.1
Pretty dumb changing the case ...
I don't think #cmdline works for versions lower than 8 or 9 (I have 7). In any event I thought that would send parms to your program rather than the compiler.
I don't think #cmdline works for versions lower than 8 or 9 (I have 7). In any event I thought that would send parms to your program rather than the compiler.
-
- Posts: 8586
- Joined: May 28, 2005 3:28
- Contact:
Re: Set optimize level using FBide and FBC 1.07.1
"excuse me wir haben 2022" It's a viral german TikTok meme
time to upgrade your FreeBASIC compiler.
Joshy
time to upgrade your FreeBASIC compiler.
Joshy
Re: Set optimize level using FBide and FBC 1.07.1
Upgraded to 9.
Compiled program with #cmdline " -O 3"
Program compiles, no errors
Run program. Program begins, get thru 10% of process or so, then freezes
Remove #cmdline option
Program compiles, no errors. Run program. Program completes normally.
Still no optimization.
Compiled program with #cmdline " -O 3"
Program compiles, no errors
Run program. Program begins, get thru 10% of process or so, then freezes
Remove #cmdline option
Program compiles, no errors. Run program. Program completes normally.
Still no optimization.
-
- Posts: 8586
- Joined: May 28, 2005 3:28
- Contact:
Re: Set optimize level using FBide and FBC 1.07.1
first try -O 2 (may be you have something strange that are optimized in a bad way with -O 3)
or show me your code.
With my settings (I posted) I get maximal performes for example ray tracing an image 20 seconds with my settings 5 secods !!!
Joshy
or show me your code.
With my settings (I posted) I get maximal performes for example ray tracing an image 20 seconds with my settings 5 secods !!!
Joshy
Re: Set optimize level using FBide and FBC 1.07.1
also, for debugging purposes add -exx, e.g. #cmdline "-exx -O 2"
-exx will slowdown performance, so after your program is debugged you probably should remove it.
-exx will slowdown performance, so after your program is debugged you probably should remove it.
Re: Set optimize level using FBide and FBC 1.07.1
Remember to use #cmdline "-gen gcc -O 2"
or #cmdline "-gen gcc -Wc -O2"
The -gen gcc bit is relevant, the default -gen gas in 32 bits is unaffected by optimisations, and SARG's compiler -gen gas64 is unaffected by optimisations, (although it is not the default compiler for 64 bits).
So you might be disappointed with optimisations due to a typo.
or #cmdline "-gen gcc -Wc -O2"
The -gen gcc bit is relevant, the default -gen gas in 32 bits is unaffected by optimisations, and SARG's compiler -gen gas64 is unaffected by optimisations, (although it is not the default compiler for 64 bits).
So you might be disappointed with optimisations due to a typo.
Re: Set optimize level using FBide and FBC 1.07.1
The program has been completely debugged and has run for some time under version 7.
For ver 9 I used the FBC64 compiler. I'm not sure under what circumstances I should use one or the other. I have a 64 bit machine.
For ver 9 I used the FBC64 compiler. I'm not sure under what circumstances I should use one or the other. I have a 64 bit machine.
Re: Set optimize level using FBide and FBC 1.07.1
FBC64 produces a 64-bit executable whereas FBC32 produces a 32-bit exe
one thing to watch out for if you are accustomed to writing programs for 32-bit and then decide you want to compile that program for 64-bit is for long and integer variables, in 32-bit a long is the same size as integer but in 64-bit an integer is 64-bit, sometimes that makes a big difference
one thing to watch out for if you are accustomed to writing programs for 32-bit and then decide you want to compile that program for 64-bit is for long and integer variables, in 32-bit a long is the same size as integer but in 64-bit an integer is 64-bit, sometimes that makes a big difference
Re: Set optimize level using FBide and FBC 1.07.1
Compiles with #CMDLINE "-O 2"
Same result at -O 3 (compiles no errors, runs 10% and freezes)
"-gen gcc -O 2" doesn't work since it creates errors in my code using GOSUBs then compile quits early ... too much to change for that option.
Same result at -O 3 (compiles no errors, runs 10% and freezes)
"-gen gcc -O 2" doesn't work since it creates errors in my code using GOSUBs then compile quits early ... too much to change for that option.
Re: Set optimize level using FBide and FBC 1.07.1
Flyzone
to use Gosub you need to either use:
#lang "QB"
or
#lang "fblite"
option gosub
keep in mind that if you use #lang "QB" then the integer types will be that of QB and not FB, consult the FB manual
to use Gosub you need to either use:
#lang "QB"
or
#lang "fblite"
option gosub
keep in mind that if you use #lang "QB" then the integer types will be that of QB and not FB, consult the FB manual
-
- Posts: 8586
- Joined: May 28, 2005 3:28
- Contact:
Re: Set optimize level using FBide and FBC 1.07.1
I had both of those specs for GOSUB but The "gen gcc" option overrides them and causes a reversion to the primary dialect which outlaws GOSUB.
The code is intended as pseudocode for a 1960s computer (1401) for sorting (which it didn't do very well) and would be funny looking stuff for this group so I'll just go without optimizing. I'd have more suggestions for change than I could count Thanks for the help.
The code is intended as pseudocode for a 1960s computer (1401) for sorting (which it didn't do very well) and would be funny looking stuff for this group so I'll just go without optimizing. I'd have more suggestions for change than I could count Thanks for the help.