App slower as exe than from IDE

Just starting out? Need help? Post your questions and find answers here.
Dude
Addict
Addict
Posts: 1907
Joined: Mon Feb 16, 2015 2:49 pm

App slower as exe than from IDE

Post by Dude »

[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? :shock: How can launching PureBasic.exe make MyApp.exe speed up?
Last edited by Dude on Mon Sep 25, 2017 12:56 pm, edited 1 time in total.
Bitblazer
Enthusiast
Enthusiast
Posts: 736
Joined: Mon Apr 10, 2017 6:17 pm
Location: Germany
Contact:

Re: App slower as exe than from IDE

Post by Bitblazer »

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.
Dude
Addict
Addict
Posts: 1907
Joined: Mon Feb 16, 2015 2:49 pm

Re: App slower as exe than from IDE

Post by Dude »

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! :shock:
Wolfram
Enthusiast
Enthusiast
Posts: 568
Joined: Thu May 30, 2013 4:39 pm

Re: App slower as exe than from IDE

Post by Wolfram »

What it inside the loop?
Is it just a internal calculation or do you reading data from network, filesystem or similar?
macOS Catalina 10.15.7
Dude
Addict
Addict
Posts: 1907
Joined: Mon Feb 16, 2015 2:49 pm

Re: App slower as exe than from IDE

Post by Dude »

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. :(
cas
Enthusiast
Enthusiast
Posts: 597
Joined: Mon Nov 03, 2008 9:56 pm

Re: App slower as exe than from IDE

Post by cas »

Post Reply