QB64 Phoenix Edition
Could someone explain these references I keep seeing to compiling with "-O2"? - Printable Version

+- QB64 Phoenix Edition (https://staging.qb64phoenix.com)
+-- Forum: Chatting and Socializing (https://staging.qb64phoenix.com/forumdisplay.php?fid=11)
+--- Forum: General Discussion (https://staging.qb64phoenix.com/forumdisplay.php?fid=2)
+--- Thread: Could someone explain these references I keep seeing to compiling with "-O2"? (/showthread.php?tid=534)



Could someone explain these references I keep seeing to compiling with "-O2"? - hanness - 06-09-2022

I'm not clear what these optimizations do. Could someone give me a basic explanation of what this is?

If I want to try this in 0.8.0, do I simply plug that into Options > C++ Compiler Settings > C++ Compiler Flags?

Are there any negatives to using this flag that I should be aware of?


RE: Could someone explain these references I keep seeing to compiling with "-O2"? - DSMan195276 - 06-09-2022

Settings like
-O2
,
-O3
, etc. are C++ compiler optimization settings. Generally speaking, they speed up (and usually decrease the size) of the compiled program by perform optimizations when compiling the C++ code. Theoretically it doesn't matter what it does because as a QB64 developer you're not writing the C++ code anyway.

Personally, if you're not familiar with what those flags do then I'm not sure I would recommend using it at this point, as it's still not extremely clear how stable QB64 programs are when compiled with that setting. That said a fair number of community members have been using them and I don't think I've seen any issues reported yet, so that is a good sign.

To use
-O2
you can simply check the 'Compile program with C++ optimization flag' option in that dialog. To use any other option besides
-O2
you'll have to put it into the compiler flags yourself.


RE: Could someone explain these references I keep seeing to compiling with "-O2"? - hanness - 06-09-2022

(06-09-2022, 09:17 PM)DSMan195276 Wrote: Settings like
-O2
,
-O3
, etc. are C++ compiler optimization settings. Generally speaking, they speed up (and usually decrease the size) of the compiled program by perform optimizations when compiling the C++ code. Theoretically it doesn't matter what it does because as a QB64 developer you're not writing the C++ code anyway.

Personally, if you're not familiar with what those flags do then I'm not sure I would recommend using it at this point, as it's still not extremely clear how stable QB64 programs are when compiled with that setting. That said a fair number of community members have been using them and I don't think I've seen any issues reported yet, so that is a good sign.

To use
-O2
you can simply check the 'Compile program with C++ optimization flag' option in that dialog. To use any other option besides
-O2
you'll have to put it into the compiler flags yourself.
Thanks for the explanation. That helped greatly.


RE: Could someone explain these references I keep seeing to compiling with "-O2"? - James D Jarvis - 06-09-2022

-O0 is normally none and least optimized, -O3 the most optimized and hopefully quickest. (not sure is QB64 supports -O0)


RE: Could someone explain these references I keep seeing to compiling with "-O2"? - bplus - 06-09-2022

I have been running allot of programs updating my files with new QB64 IDE v.8 and only problem I have run into is files with $, not just files but paths that have them too!

Here is my optimizing setting: