#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    38
    Rep Power
    12

    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.
  2. #2
  3. I'm Baaaaaaack!
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Jul 2003
    Location
    Maryland
    Posts
    5,538
    Rep Power
    243
    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.

    My blog, The Fount of Useless Information http://sol-biotech.com/wordpress/
    Free code: http://sol-biotech.com/code/.
    Secure Programming: http://sol-biotech.com/code/SecProgFAQ.html.
    Performance Programming: http://sol-biotech.com/code/PerformanceProgramming.html.
    LinkedIn Profile: http://www.linkedin.com/in/keithoxenrider

    It is not that old programmers are any smarter or code better, it is just that they have made the same stupid mistake so many times that it is second nature to fix it.
    --Me, I just made it up

    The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man.
    --George Bernard Shaw
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    38
    Rep Power
    12
    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.
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    38
    Rep Power
    12
    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.
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    38
    Rep Power
    12
    Ftping files from the UNIX box seems to be the pig within the whole program, which I can understand.
  10. #6
  11. I'm Baaaaaaack!
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Jul 2003
    Location
    Maryland
    Posts
    5,538
    Rep Power
    243
    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.

    My blog, The Fount of Useless Information http://sol-biotech.com/wordpress/
    Free code: http://sol-biotech.com/code/.
    Secure Programming: http://sol-biotech.com/code/SecProgFAQ.html.
    Performance Programming: http://sol-biotech.com/code/PerformanceProgramming.html.
    LinkedIn Profile: http://www.linkedin.com/in/keithoxenrider

    It is not that old programmers are any smarter or code better, it is just that they have made the same stupid mistake so many times that it is second nature to fix it.
    --Me, I just made it up

    The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man.
    --George Bernard Shaw
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    38
    Rep Power
    12
    Thank you.

IMN logo majestic logo threadwatch logo seochat tools logo