Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Message pumps - can they bee removed

Author
Message
Code Maker
8
Years of Service
User Offline
Joined: 4th Dec 2015
Location:
Posted: 26th May 2019 19:30
In an old thread Kevin Picone writes this https://forum.thegamecreators.com/thread/220958

"From memory, the Dbpro compiler defaults to building loops that include 'message pumps' so the user can break out of infinite loops.
There's a toggle somewhere to turn it off"

I would like to know if there is any way to remove these 'message pumps' after my code compiles error free, to gain speed ?
Sedit
6
Years of Service
User Offline
Joined: 3rd Sep 2017
Location: Ghetto of NJ
Posted: 30th May 2019 23:21
We found in the past if I recall correctly that infinite while(true) loops do not perform the correctness test and if one creates their own form of breaking out of it then it becomes much faster. I bench marked this against C++ in a thread here a while back and found that the while true loops were on par with C++ loops. Not quite as fast but damn close. The for-loops I believe it were however were significantly slower.

Sorry its been a while since I coded in basic so here is sudo code for a for a = 0 to 100 loop


Sorry if that does not make sense. It has been a while since I used DB but perhaps someone could provide a better example if need be.
Sphere sphere = new Sphere(0.5f);
InsanelyRedundantJava insanelyredundantjava = new InsanelyRedundantJava(Redundancy1, Redundancy2);
YouTube: https://www.youtube.com/channel/UC0WGoCiVQxMdPxZZkqFks1g?view_as=subscriber
Discord: https://discord.gg/sQazuty
Sedit
6
Years of Service
User Offline
Joined: 3rd Sep 2017
Location: Ghetto of NJ
Posted: 30th May 2019 23:23 Edited at: 30th May 2019 23:30
Ahh... Found it... Hope this helps my man,

https://forum.thegamecreators.com/thread/220958


ALSO READ THAT POST AND IGNORE MY ABOVE ONE SORRY Sorry for the caps just want to make sure you see this... It is the For-Next Infinite loop I believe that was faster. IDK, it was like a year ago and my memory is shit. I am also much better at benchmarking so soon IF I can get DB setup again I am going to run much more comprehensive benchmarks with the benchmark API I wrote for C++
Sphere sphere = new Sphere(0.5f);
InsanelyRedundantJava insanelyredundantjava = new InsanelyRedundantJava(Redundancy1, Redundancy2);
YouTube: https://www.youtube.com/channel/UC0WGoCiVQxMdPxZZkqFks1g?view_as=subscriber
Discord: https://discord.gg/sQazuty
Ortu
DBPro Master
16
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 31st May 2019 18:38 Edited at: 31st May 2019 18:40
For i = 0 to x : next i is very fast, and does not pump messages... be careful though, without the pump windows can flag the app as not responding

While/repeat loops, next array index, etc are slower and do pump, but won't hang the app
http://games.joshkirklin.com/sulium

A single player RPG featuring a branching, player driven storyline of meaningful choices and multiple endings alongside challenging active combat and intelligent AI.
Code Maker
8
Years of Service
User Offline
Joined: 4th Dec 2015
Location:
Posted: 3rd Jun 2019 21:41
Thanks for your reply Sedit and Ortu, i guess that for maximum speed you would go with a for/next loop optionally with a check to break out of the loop,
i just hope that windows dont produce an error message that my app is not responding, i think that would happen if windows have not gotten a "message pump"
from the app in a predefined interval.

Login to post a reply

Server time is: 2024-03-29 08:47:45
Your offset time is: 2024-03-29 08:47:45