Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
why the qb64 editor is slow under linux
#11
Have you checked the results of simply adding `-O2` to the builds of `libqb_setup.o` and `qbx.cpp`, rather than `-Ofast`? I'm surprised that they're not already compiled with `-O2`,  that's certainly something I think should be changed and would likely be sufficient to fix this problem.

`-O3` is also an option, but frankly considering the state the `libqb.cpp` code is in I'm somewhat hesitant to recommend that if `-O2` is sufficient. I would personally not recommend using `-Ofast` because on top of `-O3` it actually enables several non-standards-compliant optimizations which I suspect may cause us problems in some situations.
Reply
#12
yes i read on the net that the -Ofast parameter leads to a stronger maximum optimization than -O3 and can have effects on stability but i used -Ofast with many basic languages like freebasic and some interpreters. I haven't noticed any visible problem with qb64 yet. it's faster. that's a fact and so are the programs generated. more testing is needed. i'm also surprised that libqb.cpp isn't compiled at least with -O2. maybe the original author of qb64 knows something we don't. we should ask him. to play it safe, maybe it would be better to stick to -O2 or -O3. i'm in the testing phase for now. it seems there are not many linux users in this forum. it could have helped. i can't do everything by myself. there should be beta testers of the version compiled with -Ofast to report possible problems.


@DSMan195276. are you using linux?
Reply
#13
I definitely understand it's faster, compiling without any optimizations can produce painfully slow programs. That said again I would caution against `-Ofast` and just stick with `-O2` for now. Certainly you can do it anyway Smile But I would be shocked if there wasn't code in there somewhere that's broken by `-O3` and/or `-Ofast`, so you're taking your chances.

[url=https://qb64phoenix.com/forum/member.php?action=profile&uid=21][/url]
Quote:are you using linux?

Yeah, I use both Windows and Linux depending on the day Smile Definitely prefer Linux when I can.
Reply
#14
with firejail i can isolate qb64 in a sandox. i can launch both versions at the same time. i'll see if it's worth it or not...
Reply
#15
the old script had an error. here is the corrected update.

after reading some information about gcc, i decided to use the -O3 compiler option. it's a good compromise between security and speed.

if this is your first installation of qb64, it is advised to run the script setup_lnx.sh to install the package dependencies necessary for qb64...

this script allows to insert the -O3 compiler option of gcc g++ to optimize qb64. the original files are saved. i removed some useless sections of the original script setup_lnx.sh. download the source code of qb64, unzip, put the script in the directory where is setup_lnx.sh, make it executable and run it. the processing is automatic. if the compilation was successful, the qb64 executable will be created:

compile_qb64.sh
Code: (Select All)
#!/bin/bash
# QB64 Installer
# Argument 1: If not blank, qb64 will not be started after compilation

dont_run="$1"

#This checks the currently installed packages for the one's QB64 needs
#And runs the package manager to install them if that is the case
# *** SECTION ENLEVE ***


#Make sure we're not running as root
if [ $EUID == "0" ]; then
  echo "You are trying to run this script as root. This is highly unrecommended."
  echo "This script will prompt you for your sudo password if needed to install packages."
  exit 1
fi

GET_WGET=
#Path to Icon
#Relative Path to icon -- Don't include beginning or trailing '/'
QB64_ICON_PATH="internal/source"

#Name of the Icon picture
QB64_ICON_NAME="qb64icon32.png"

DISTRO=

lsb_command=`which lsb_release 2> /dev/null`
if [ -z "$lsb_command" ]; then
  lsb_command=`which lsb_release 2> /dev/null`
fi

#Outputs from lsb_command:

#Arch Linux  = arch
#Debian      = debian
#Fedora      = Fedora
#KUbuntu     = ubuntu
#LUbuntu     = ubuntu
#Linux Mint  = linuxmint
#Ubuntu      = ubuntu
#Slackware   = slackware
#VoidLinux   = voidlinux
#XUbuntu     = ubuntu
#Zorin       = Zorin
if [ -n "$lsb_command" ]; then
  DISTRO=`$lsb_command -si | tr '[:upper:]' '[:lower:]'`
elif [ -e /etc/arch-release ]; then
  DISTRO=arch
elif [ -e /etc/debian_version ] || [ -e /etc/debian_release ]; then
  DISTRO=debian
elif [ -e /etc/fedora-release ]; then
  DISTRO=fedora
elif [ -e /etc/redhat-release ]; then
  DISTRO=redhat
elif [ -e /etc/centos-release ]; then
  DISTRO=centos
fi

#Find and install packages
# *** SECTION ENLEVE ***

echo "Compiling and installing QB64..."

### Build process
find . -name "*.sh" -exec chmod +x {} \;
find internal/c/parts -type f -iname "*.a" -exec rm -f {} \;
find internal/c/parts -type f -iname "*.o" -exec rm -f {} \;
find internal/c/libqb -type f -iname "*.o" -exec rm -f {} \;
rm ./internal/temp/*

echo "Modification 'makeline*'"
cp ./internal/c/makeline_lnx.txt ./internal/c/makeline_lnx_ORG.txt
find ./internal/c -type f -name "makeline_lnx.txt" -print0 | xargs -0 sed -i 's/g++ -no-pie -w qbx.cpp/g++ -O3 -no-pie -w qbx.cpp/g'
cp ./internal/c/makeline_lnx_nogui.txt ./internal/c/makeline_lnx_nogui_ORG.txt
find ./internal/c -type f -name "makeline_lnx_nogui.txt" -print0 | xargs -0 sed -i 's/g++ -no-pie -w qbx.cpp/g++ -O3 -no-pie -w qbx.cpp/g'

echo "Building library 'LibQB'"
pushd internal/c/libqb/os/lnx >/dev/null
rm -f libqb_setup.o
cp setup_build.sh setup_build_ORG.sh
cp build_test.sh build_test_ORG.sh
find . -type f -name "*.sh" -print0 | xargs -0 sed -i 's/g++ -c -w -Wall/g++ -O3 -c -w -Wall/g'
./setup_build.sh
popd >/dev/null

echo "Building library 'FreeType'"
pushd internal/c/parts/video/font/ttf/os/lnx >/dev/null
rm -f src.o
cp setup_build.sh setup_build_ORG.sh
cp build.sh build.sh_ORG.sh
find . -type f -name "*.sh" -print0 | xargs -0 sed -i 's/g++ -s -c -w -Wall/g++ -s -O3 -c -w -Wall/g'
./setup_build.sh
popd >/dev/null

echo "Building library 'Core:FreeGLUT'"
pushd internal/c/parts/core/os/lnx >/dev/null
rm -f src.a
cp setup_build.sh setup_build_ORG.sh
cp build.sh build.sh_ORG.sh
find . -type f -name "*.sh" -print0 | xargs -0 sed -i 's/gcc -s -O2 -c/gcc -s -O3 -c/g'
./setup_build.sh
popd >/dev/null

echo "Building 'QB64'"
tar -czvf ./internal/source/main.tar.gz ./internal/source/main.txt
find ./internal/source -type f -name "main.txt" -print0 | xargs -0 sed -i 's/g++ -c -s -w -Wall libqb.cpp -D FREEGLUT_STATIC/g++ -O3 -c -s -w -Wall libqb.cpp -D FREEGLUT_STATIC/g'
cp -r ./internal/source/* ./internal/temp/
pushd internal/c >/dev/null
g++ -O3 -no-pie -w qbx.cpp libqb/os/lnx/libqb_setup.o parts/video/font/ttf/os/lnx/src.o parts/core/os/lnx/src.a -lGL -lGLU -lX11 -lpthread -ldl -lrt -D FREEGLUT_STATIC -o ../../qb64
popd

if [ -e "./qb64" ]; then
  echo "DISTRO: $DISTRO"
  echo "Done compiling!!"
  echo
  echo "QB64 is located in this folder:"
  echo "`pwd`"
else
  ### QB64 didn't compile
  echo "It appears that the qb64 executable file was not created, this is usually an indication of a compile failure (You probably saw lots of error messages pop up on the screen)"
  echo "Usually these are due to missing packages needed for compilation. If you're not running a distro supported by this compiler, please note you will need to install the packages listed above."
  echo "If you need help, please feel free to post on the QB64 Forums detailing what happened and what distro you are using."
  echo "Also, please tell them the exact contents of this next line:"
  echo "DISTRO: $DISTRO"
fi
echo
echo "Thank you for using the QB64 installer."
Reply
#16
Script update here
Reply




Users browsing this thread: 1 Guest(s)