Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Could someone explain these references I keep seeing to compiling with "-O2"?
#1
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?
Reply
#2
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.
Reply
#3
(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.
Reply
#4
-O0 is normally none and least optimized, -O3 the most optimized and hopefully quickest. (not sure is QB64 supports -O0)
Reply
#5
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:
   
b = b + ...
Reply




Users browsing this thread: 3 Guest(s)