[Edit] Solved -- see my post further down.
So I've got a loop going in my app, which takes about 5 seconds if I run it from the PureBasic IDE, but 30 seconds as a standalone exe. What the heck? How can a compiled standalone exe be slower than when run in the IDE?
Even weirder: if I run the standalone exe and start the 30-second loop, but then also open PureBasic's IDE, then my exe immediately speeds up and finishes the loop fast!
I have no idea how to even diagnose this. The only clues are that the EditorGadget is involved and I'm adding lines of text to it with AddGadgetItem(#editor,-1,text$).
Anyone ever seen anything like this at all? How can launching PureBasic.exe make MyApp.exe speed up?
App slower as exe than from IDE
App slower as exe than from IDE
Last edited by Dude on Mon Sep 25, 2017 12:56 pm, edited 1 time in total.
Re: App slower as exe than from IDE
Check and toggle your debugger settings. Sounds like (for some reason) a communication attempt with the ide/debugger happens and fails after a timeout of active waiting. But its just a quick guess.
ps: for diagnosing you could start to monitor all external communication of the exe. This however CAN be tricky as it can happen in many different ways (pipes, sockets, shared memory/files etc. via filesystem or network or other shared resources) A good start for monitoring and debugging these things, is knowing the Sysinternals Suite as well as Wireshark, IDA pro and Russinovich Lectures.
ps: for diagnosing you could start to monitor all external communication of the exe. This however CAN be tricky as it can happen in many different ways (pipes, sockets, shared memory/files etc. via filesystem or network or other shared resources) A good start for monitoring and debugging these things, is knowing the Sysinternals Suite as well as Wireshark, IDA pro and Russinovich Lectures.
Re: App slower as exe than from IDE
All debugger settings are off, but that doesn't apply to a standalone exe anyway.
I have no idea how one process (PureBasic.exe) can affect another running process (MyApp.exe), but it's happening.
Bizarre stuff!
I have no idea how one process (PureBasic.exe) can affect another running process (MyApp.exe), but it's happening.
Bizarre stuff!
Re: App slower as exe than from IDE
What it inside the loop?
Is it just a internal calculation or do you reading data from network, filesystem or similar?
Is it just a internal calculation or do you reading data from network, filesystem or similar?
macOS Catalina 10.15.7
Re: App slower as exe than from IDE
Okay, found it! It was due to Delay(1) in my main loop, when WindowEvent()=0, which was slowing things down. I changed it to WaitWindowEvent(1) instead and the slowdown has gone from the standalone exe. Problem solved.
However, that still begs these two very important questions: why didn't this slowdown occur when I ran my app from the IDE, or when PureBasic.exe was running alongside MyApp.exe? Surely those two exes don't "talk" to each other with window events? It's no wonder I couldn't find the bug at first, as it mysteriously "went away" whenever the PureBasic.exe process was running! Nobody can expect to easily debug a situation like that.
However, that still begs these two very important questions: why didn't this slowdown occur when I ran my app from the IDE, or when PureBasic.exe was running alongside MyApp.exe? Surely those two exes don't "talk" to each other with window events? It's no wonder I couldn't find the bug at first, as it mysteriously "went away" whenever the PureBasic.exe process was running! Nobody can expect to easily debug a situation like that.