Comparison QB64 compiled with gcc optimizations and without - Printable Version +- QB64 Phoenix Edition (https://qb64phoenix.com/forum) +-- Forum: Chatting and Socializing (https://qb64phoenix.com/forum/forumdisplay.php?fid=11) +--- Forum: General Discussion (https://qb64phoenix.com/forum/forumdisplay.php?fid=2) +--- Thread: Comparison QB64 compiled with gcc optimizations and without (/showthread.php?tid=366) |
RE: Comparison QB64 compiled with Ofast and without - mnrvovrfc - 09-02-2022 (08-31-2022, 09:30 PM)Coolman Wrote: :What a shame this still can't be done with v3.0 on Linux! Therefore this test is very subjective to me. What I think is Freebasic should be involved in this testing. Meh compiler switches, something else besides "_INTEGER64", "_MEM", and besides real audio far better than "BEEP", and besides way better graphics than "CHR$()" capability on 8-bit computers and much more, on QB64's side only that the BASIC programmer, who was a newbie decades ago, has to come across in these later, burgeoning times. There is the trap about the programmer who starts being obsessed with compiler switches "to make it run faster", but doesn't want to go full-on into C/C++. Pretty soon he/she is going to want to do nothing at all. RE: Comparison QB64 compiled with Ofast and without - SMcNeill - 09-02-2022 What can't be done on Linux? Inflate and Deflate files? I'm pretty certain those are cross-compatible routines. The compile options? I think they work on Linux as well. What can't be done on Linux?? RE: Comparison QB64 compiled with Ofast and without - mnrvovrfc - 09-02-2022 If you don't believe me: [attachment=813] QB64PE thinks "_DEFLATE" is an array. LOL forgot the dollar sign after the function name, but when I included it, this is what I got instead: [attachment=814] Contents of ".../qb64pe/internal/temp/compilelog.txt": Code: (Select All) g++ -w -std=gnu++11 -DFREEGLUT_STATIC -I./internal/c/libqb/include -DDEPENDENCY_NO_SOCKETS -DDEPENDENCY_NO_PRINTER -DDEPENDENCY_NO_ICON -DDEPENDENCY_NO_SCREENIMAGE -DDEPENDENCY_ZLIB internal/c/libqb.cpp -c -o internal/c/libqb_make_0000000000001.o This is on Fedora 36 XFCE, which was updated last week. It shouldn't be any different in any other Linux distro, maybe except the ones where the user has to hunt down the dependencies because "setup_lnx.sh" didn't do enough. I'm sorry for the off-topic. RE: Comparison QB64 compiled with Ofast and without - SMcNeill - 09-02-2022 Short answer: You're not finding the zlib library. Do you have the zlib dependencies installed on that version of Linux? RE: Comparison QB64 compiled with Ofast and without - mnrvovrfc - 09-02-2022 (09-02-2022, 06:08 PM)SMcNeill Wrote: Short answer: You're not finding the zlib library. Do you have the zlib dependencies installed on that version of Linux?No, but before I had to give this terminal command: sudo yum install zlib-static (This is only on Fedora 36, for other Linux distro the command will be different such as "pacman" on Arch, "apt-get" on Debian/Ubuntu etc. Also the name of the package might be different but should have "zlib" as lead name or something. Saying that for those who beg for more education about it.) Thank you for your answer. RE: Comparison QB64 compiled with Ofast and without - Coolman - 09-02-2022 I point out that I use a linux distribution based on ubuntu 20.04 and that this code works perfectly : Code: (Select All) Dim tab$(19) RE: Comparison QB64 compiled with Ofast and without - Coolman - 09-06-2022 I saw in a post this sentence: -Os enables all -O2 optimizations except those that often increase code size by curiosity i compiled a program with this option, the executable has a size of about 1.3 mo while with the -O3 optimization it's about 1.9 mo. surprising, 600 k more. in addition the compiling time is much faster. so i decided to make a comparison test with the old data, here is the result : simple code using pset 2.3x seconds : program compiled with qb64 v0.5.0 -O3 2.1x seconds : program compiled with qb64 v3.0.0 -O3 2.6x seconds : program compiled with qb64 v3.1.0 -Os 3.5x seconds : program compiled with qb64 v0.5.0 original Fractal Tree : I got this code from the site rosettacode. 2.9x seconds : program compiled with qb64 v0.5.0 -O3 3.0x seconds : program compiled with qb64 v3.0.0 -O3 3.4x seconds : program compiled with qb64 v3.1.0 -Os 6.1x seconds : program compiled with qb64 v0.5.0 original Bucketsort : I got this code from the site rosettacode. 1.1x seconds : program compiled with qb64 v0.5.0 -O3 1.0x seconds : program compiled with qb64 v3.0.0 -O3 1.0x seconds : program compiled with qb64 v3.1.0 -Os 3.4x seconds : program compiled with qb64 v0.5.0 original sorting algorithm QuickSort. 3.0x seconds : program compiled with qb64 v0.5.0 -O3 3.0x seconds : program compiled with qb64 v3.0.0 -O3 3.2x seconds : program compiled with qb64 v3.1.0 -Os 4.6x seconds : program compiled with qb64 v0.5.0 original Alien Trees Reflection - Plasma Mod. 5.3x seconds : program compiled with qb64 v0.5.0 -O3 5.4x seconds : program compiled with qb64 v3.0.0 -O3 6.7x seconds : program compiled with qb64 v3.1.0 -Os 9.2x seconds : program compiled with qb64 v0.5.0 original Nbody 16.9x seconds : program compiled with qb64 v0.5.0 -O3 16.5x seconds : program compiled with qb64 v3.0.0 -O3 23.8x seconds : program compiled with qb64 v3.1.0 -Os 68.0x seconds : program compiled with qb64 v0.5.0 original Picture unroller 1.3x seconds : program compiled with qb64 v0.5.0 -O3 1.1x seconds : program compiled with qb64 v3.0.0 -O3 1.8x seconds : program compiled with qb64 v3.1.0 -Os 2.5x seconds : program compiled with qb64 v0.5.0 original New screen - How ?. Found in the old forum. 1.4x seconds : program compiled with qb64 v0.5.0 -O3 1.1x seconds : program compiled with qb64 v3.0.0 -O3 1.9x seconds : program compiled with qb64 v3.1.0 -Os 2.3x seconds : program compiled with qb64 v0.5.0 original opens a text file of about 4 mo to read it line by line three times in a row with the use of Left$ InStr 6.5x seconds : program compiled with qb64 v0.5.0 -O3 6.3x seconds : program compiled with qb64 v3.0.0 -O3 6.7x seconds : program compiled with qb64 v3.1.0 -Os 7.2x seconds : program compiled with qb64 v0.5.0 original a very simple code that opens a text file of about 4 mo to read it line by line and copy it to a new file. 3.0x seconds : program compiled with qb64 v0.5.0 -O3 2.7x seconds : program compiled with qb64 v3.0.0 -O3 2.9x seconds : program compiled with qb64 v3.1.0 -Os 3.0x seconds : program compiled with qb64 v0.5.0 original here is another very simple code that copies a test file of about 4 mo to an array and copies the data randomly to another array. program compiled with qb64 v0.5.0 -O3 4.4x seconds : Read file and copy to table 7.1x seconds : Copy data randomly into another table. program compiled with qb64 v3.0.0 -O3 4.6x seconds : Read file and copy to table 8.3x seconds : Copy data randomly into another table. program compiled with qb64 v3.1.0 -Os 4.9x seconds : Read file and copy to table 8.3x seconds : Copy data randomly into another table. program compiled with qb64 v0.5.0 original 5.9x seconds : Read file and copy to table 27.4x seconds : Copy data randomly into another table. found a code in the old forum 13.2x seconds : program compiled with qb64 v0.5.0 -O3 10.8x seconds : program compiled with qb64 v3.0.0 -O3 10.1x seconds : program compiled with qb64 v3.1.0 -Os 26.2x seconds : program compiled with qb64 v0.5.0 original CRC-32 : I got this code from the site rosettacode. 6.7x seconds : program compiled with qb64 v0.5.0 -O3 6.9x seconds : program compiled with qb64 v3.0.0 -O3 10.1x seconds : program compiled with qb64 v3.1.0 -Os 17.6x seconds : program compiled with qb64 v0.5.0 original _Deflate (compression) and _Inflate (decompression) functions. program compiled with qb64 v0.5.0 -O3 : Function _Deflate : 10.1x seconds Function _Inflate : 1.2x seconds program compiled with qb64 v3.0.0 -O3 : Function _Deflate : 9.5x Function _Inflate : 1.2x program compiled with qb64 v3.1.0 -Os : Function _Deflate : 9.5x Function _Inflate : 1.2x program compiled with qb64 v0.5.0 original : Function _Deflate : 10.1x seconds Function _Inflate : 1.2x seconds In conclusion : programs compiled with -O3 are still faster but not by much. compile times are longer and the size of the generated executables is much larger. using the -Os option seems to be a good compromise between speed gain and optimization of the program size. the compile time is also an important criterion. after these results, i recompiled the whole qb64 in -Os. the size of the executable is about 5.5 MB instead of 7.5 MB with -O3. finally i decided to adopt the -Os option, it's mainly the gains in compile time and size of the generated programs that convinced me. RE: Comparison QB64 compiled with Ofast and without - Jack - 09-06-2022 Coolman I am glad that you finally realized that -O3 is rarely beneficial, you may get a small speed increase but not always, I prefer -O2 could you post the Bucket Sort ? RE: Comparison QB64 compiled with Ofast and without - Coolman - 09-06-2022 @Jack I think -Os is even better with the reduction of the size of the generated executables and an important gain during the compilation. you can find Bucket Sort in the first post here : https://qb64phoenix.com/forum/showthread.php?tid=366&pid=1851#pid1851 RE: Comparison QB64 compiled with Ofast and without - Jack - 09-06-2022 Bucket Sort times -O2 .88 sec -O3 .7 sec -Os .72 sec keep in mind that timing differences between O levels may differ for different programs, sometimes -O2 is best and sometimes -Os |