|
Post by emulog on Jan 6, 2023 11:43:58 GMT
I am writing yet another z80 cpu emulator, and still try do make it faster, use lot of LUTs, try data toss optimization. I see that QB64 do have runtime wrappings to its compiled code, it is always possible to get errors like bound check fail, and i think, maybe these cause some extra slowdown. Such things as bound checks, c++ extra data toss here and there vs pure asm. Or maybe i can get resulting asm code which gcc produce and apply inline asm manually ? Not an asm guru though.
|
|
tonylazuto
New Member
Tony Lazuto says hello
Posts: 25
|
Post by tonylazuto on Jan 6, 2023 14:07:11 GMT
Maybe you're looking for $CHECKING:OFF
|
|
|
Post by emulog on Jan 7, 2023 8:04:29 GMT
Thanks a lot, will try. PS.. Got it checked for a code performing 3*3 blur over ZX Spectrum 48K screen image (6912B) to RGB output, had 110 FPS on my 5700G, and without checks it done 144 FPS. 31% of speed up is a lot, cool. Wish QB64 had multithread subs and inilne asm, many things gonna fly.
|
|
tonylazuto
New Member
Tony Lazuto says hello
Posts: 25
|
Post by tonylazuto on Jan 10, 2023 14:59:54 GMT
Now, the only thing about $CHECKING:OFF is that it should only be used with bug-free code. It's typically not recommended to use $CHECKING:OFF for the entire code but individual code blocks instead. That way you get the benefit of checking for things that definitely could go haywire but get the speed boost in parts that you know are good.
|
|
|
Post by emulog on Jan 19, 2023 14:18:19 GMT
Indeed. First Ive tried to put it just at start, see what happens. Code is stable, runs faster. Then found some snippet of a sub, where author put $off at start of sub, while at the end were $on. Well why not, did the same. Runs ok. A bit slower, though. Then found some quirk. While put $on at several heavy sub's ends, tried to put $off at just at start too, again. Got speed loss. Not severe but significant. Aint got any idea why, so reverted all these $ back and use plain $off at start. Quite enough. And, regarding further speed ups, ive tried QB64PE. Its a fork, so i compiled same *.bas file there, no problem. Same speed. But there in options i found "compiler settings", none of such in QB. Enabled "Compile program with C++ optimization flag", and compiled again. Oh my, the bird now fly. Okay, so where this setting in QB ? Not having it in menu, lets see makeline_lnx. I already put -O3 and -march native there before. Other options are g++ -no-pie -w qbx.cpp parts/core/os/lnx/src.a -lGL -lGLU -lX11 -lpthread -ldl -lrt -D FREEGLUT_STATIC -o3 -pipe -march=native. -w is about warnings -no-pie is about position independancy -l.. is about libraries Where is that magic button here, both QB and PE use same GCC and compile C++ source.
|
|
tonylazuto
New Member
Tony Lazuto says hello
Posts: 25
|
Post by tonylazuto on Jan 19, 2023 16:17:54 GMT
I think you would have to manually add the compiler flags in QB64. QB64PE has the option to add it through that IDE dialog.
|
|