August 13th, 2003, 05:15 PM
VC++ VS. VB speed
I just had to recode a very large VB program into VC++ because the VB program was really slow. I am finished for the most part and it is somewhat faster, but I was expecting more. Is'nt C++ quite a bit faster at opening files, parsing data, ftping files and outputing to a file. I created my project as a Win32 Console application, but now that I am finished and understand the program better I don't think I need the console. I don't use it to display anything and have it set to close it self. It does seem to slow down the program though and the purpose of the rewrite was to make it as fast as possible. Is there any way to remove the console without a creating a new project? Any suggestion or answers would be greatly appreciated. Thanks.
August 13th, 2003, 05:34 PM
How do you know that the problem is that it is written in VB? I took a Perl program and rewrote it (still in Perl) and got it to run in 12 minutes vs 15 hours by changing the logic of the program. I suspect that your performance 'problem' may not be that it is in VB but rather the logic of the program. Optimzing programs for speed is still much more of an art than a science, all the compiler switches to the contrary. Speaking of compiler switches, please tell me you are compiling in 'Release' mode and not in 'Debug' mode.
What is the program doing? Have you searched for other ways of doing the same thing? Do you even have proof that the program is slow? If it is I/O or network bound, no amount of tinkering with the code will have the slightest impact on the performance. Do you know where your program is spending its time (meaning: have you profiled it)? Typically 90% of the program's execution time is spent in 10% (sometimes less) of the code.
August 13th, 2003, 05:40 PM
parse a file with 20 some tags with at least one tag signaling a COBOL program on a UNIX server to create a file. Then ftping that file back to the local machine to be outputed to a new file along with the other tags.
August 13th, 2003, 05:43 PM
It is faster and I explored many ways of doing diffrent things, I thought VC++ was faster and still do, but someone tried telling me that their is hardly any diffrence in speed between the two.
August 13th, 2003, 05:44 PM
Ftping files from the UNIX box seems to be the pig within the whole program, which I can understand.
August 13th, 2003, 05:51 PM
If the bulk of the program time is spent FTPing the file then I don't expect there is any way to improve the overall performance. One way to check is using the "Windows Task Manager" to view how much CPU your process is using (on Win2K type control-alt-delete, then 't' for task manager). If it is not running close to 100% CPU then it is not compute bound and it is not likely that any tinkering will change anything. Other than learning about some Visual C++, I suspect you have wasted your time.
You can check what is being done on the Unix side and if there are no side effects (meaning that ONLY the file is being generated and passed back) then simply create the file locally and be done with it. Even then, if the files are small with lots of 'ftp' tags, you will likely still be I/O bound and doing it in C++ is not likely to gain you much. All programs (on modern OSs anyway) make I/O and network calls through the OS so VB and C++ are using the identical calls.
August 13th, 2003, 05:55 PM