views:

206

answers:

3

Any suggestions on why a VB6 program would be slower when compiled than when running in the debugger? I'm compiling it with "Optimize for fast code."

Notes: I measure performance by running the compiled version and the non-compiled version on the same machine. I based my predictions on wall-clock time, since 30 minutes vs. 100 minutes is a big enough difference to be visible.

+1  A: 

You should select the compile to Native Code option

The compile to P-code option forces your program to run in an interpreted mode, which can be slower.

There are some optimizations in the advanced section. Try them out too.

Some more points to consider:

Are you running the compliled application in the same environment? Is it taking the same data as input?

How did you know that it is slow? What if your timing program is wrong?

Niyaz
Optimize for Fast code is only an option in Native Code mode.
Brian
A: 

How do you measure the performance?

It is hard to measure the performance by what you just said. You have to ensure the running environment must be exactly same for compare the performance?

Are you running on the same machine? Do you connect to DB? Does DB has the same work load at different run? You need isolate other factors before reaching such a decision.

J.W.
+4  A: 

Several months ago, I configured a debugging tool to attach itself to my program whenever it ran. I totally forgot that I had done this.

Special thanks to Process Monitor for making this very obvious.

Turning it off made the program run fast.

AppVerifier, for those who are curious.

Brian