Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Same code slow when built as MFC app

Status
Not open for further replies.

Sen7inel

IS-IT--Management
Feb 14, 2001
90
FI
I have a command-line utility, which uses a lot of basic C stuff like strcat and psz's to create several megabytes of output which is just printed to stdout and redirected to a file. This utility works quite fast, creating >10Mb in few seconds. The util was compiled with VC6.

I then wanted to create a nice gui for the utility, and made the interface (an MFC project). I used the exact same code for the engine part of the app, except that it fills heap with the output instead of stdoutting anything, and once finished writes this to a file. Now, the engine code which runs in its own worker thread is _enormously_ slower (takes several minutes to do what the command line version creates in seconds) in the gui version, and it still takes 99% of cpu time.

Any ideas what might cause this huge performance difference?
 
DUH, this was caused by a stupid mistake, courtesy of me. strcat isn't exactly the fastest way to write to memory.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top