CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 34
  1. #16
    Join Date
    Jan 2005
    Posts
    148

    Re: Why my application is so LAZY? Please help me out!!!!

    Orginally posted by Kevin Hall
    First suggestion: profile your code. See if there are any easy to identify bottlenecks
    Ok.

    Orginally posted by Kevin Hall
    Second suggestion: Give us something to work with. If you can't share code, can you share the psuedo code? Flow chart? We can only guess what might be wrong if you can't share what's happening.
    Hummmmm...


    Orginally posted by Kevin Hall
    Third suggestion: Tell us what your program does. What exactly are you trying to process? Where is the data coming from? Where are you writing the output to? How much data are you analyzing? What do you have to do to the text?
    Please Kindly read my previous replies.Thank you.


    Orginally posted by Kevin Hall
    Fourth suggestion: Check for common string manipulation performance killers:

    * unnecessary copying of string data. See if you can return references to strings instead

    * inserting / removal of text in the midlle of a very large string. If this operation occurs often, it's usually quicker to read data as a vector of smaller strings -- for example a text file can often be read as a vector of text lines.
    Yes, you are right, I will look at it.

    Orginally posted by Kevin Hall
    Fifth suggestion: Hire a contractor. If you don't want to debug it yourself, there are a lot of people out there willing to do it if they get paid.
    Hahaha, hey friend, actually it is written by some other programmer, otherwise I would have tried to find the problem.

    I can debug, I believe it takes long time.
    for example, this application calls a funtions for checking spaces in the input file for more than 1 million (100000) times!!!
    And lots of while and for loops are there.

    Now I'm trying here for any luck (I mean any help from you gurus...)
    If no luck then I have to sit and debug...
    That's really very scaring me......

    Thanks...

  2. #17
    Join Date
    Jan 2005
    Posts
    148

    Re: Why my application is so LAZY? Please help me out!!!!

    Orginally posted by Siddhartha
    Profiling will help.

    Use Function Profiling to find:
    1. Number of times a Function is executed.
    2. Time spent in each Function.
    This FAQ is relevant too.
    Hai Siddhartha,
    Ok, I will do profiling and reply you soon....
    Thank You.

  3. #18
    Join Date
    Jan 2004
    Location
    Bangalore
    Posts
    53

    Re: Why my application is so LAZY? Please help me out!!!!

    Hi,

    my suggestion is, try to implement logging for your application with time.

    From that you can find out where it is taking long time.


    Regards
    MJValan

  4. #19
    Join Date
    Jan 2005
    Posts
    148

    Re: Why my application is so LAZY? Please help me out!!!!

    Orginally posted by mjvalan
    my suggestion is, try to implement logging for your application with time.
    From that you can find out where it is taking long time.
    Hai mjvalan, logging for application with time? how to do that? please can you explain me? I'm little confused.

    Thanks.

  5. #20
    Join Date
    Jan 2004
    Location
    Bangalore
    Posts
    53

    Re: Why my application is so LAZY? Please help me out!!!!

    You may ve seen log files in your system, which has information about execution of some applications in your machine.

    In your program write some extra lines to create a file and write some messages with the system time.

    Ex

    main()

    {
    CreateFile("c:\xyz.log",...);
    GetsystemeTime() // I am not writing exact funtions.

    writeFile(Time+" Entering into main");
    ....
    ....
    ....
    GetsystemTime()
    WriteFile(Time+"calling fun blabla");
    blabla();
    GetsystemTime()
    WriteFile(Time+" fun blabla completed ");


    ....
    ...
    GetsystemTime();
    writeFile(Time+"Exiting function main");



    }


    ==============================

    Accroding to your requiremnet you can increase log statements in your program.

    Now by veryfing the log file you can find out that, howmuch time function blabla has taken.

    If you feel blabla is taking more time , then add some log statements in function blabla. So that you can find out the exact statement where it is taking more time.


    (Most of the programs will take more time in for/ while loops)

  6. #21
    Join Date
    Jan 2005
    Posts
    148

    Re: Why my application is so LAZY? Please help me out!!!!

    Thanks a lot mjvalan for giving the hint.
    I will also try this way.

    Thanks to all.....

  7. #22
    Join Date
    Oct 2002
    Location
    Germany
    Posts
    6,205

    Re: Why my application is so LAZY? Please help me out!!!!

    BTW, FYI, in the FAQ link mentioned before, Andreas has posted a Timer Class. You may use that too.

  8. #23
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,637

    Re: Why my application is so LAZY? Please help me out!!!!

    Quote Originally Posted by shinde
    Ok.


    I can debug, I believe it takes long time.
    for example, this application calls a funtions for checking spaces in the input file for more than 1 million (100000) times!!!
    And lots of while and for loops are there.

    Now I'm trying here for any luck (I mean any help from you gurus...)
    If no luck then I have to sit and debug...
    That's really very scaring me......

    Thanks...
    Sounds like you have your answer.

  9. #24
    Join Date
    Jan 2005
    Posts
    148

    Re: Why my application is so LAZY? Please help me out!!!!

    Orginally Posted by Siddhartha
    BTW, FYI, in the FAQ link mentioned before, Andreas has posted a Timer Class. You may use that too.
    Ok, sure, thank you Siddhartha.

    Orginally Posted by GCDEF
    Sounds like you have your answer.
    Hai GCDEF, sorry, I did not get you!!!
    What do you mean? please explain....

    I'm leaving for today. Tommarrow I hope, after following all your suggestions, I may(will) come up with the good result, and reply you all about the status.

    But GCDEF, please reply me.Thanks.

    Thanks to all.

  10. #25
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,637

    Re: Why my application is so LAZY? Please help me out!!!!

    Quote Originally Posted by shinde
    Ok, sure, thank you Siddhartha.

    Hai GCDEF, sorry, I did not get you!!!
    What do you mean? please explain....

    I'm leaving for today. Tommarrow I hope, after following all your suggestions, I may(will) come up with the good result, and reply you all about the status.

    But GCDEF, please reply me.Thanks.

    Thanks to all.
    Look at what I quoted. You said it's calling the same function to check for spaces over a million times. Why?

  11. #26
    Join Date
    Apr 1999
    Posts
    27,449

    Re: Why my application is so LAZY? Please help me out!!!!

    I have to respond, please take this kindly:
    Quote Originally Posted by shinde
    I'm sorry zoli, due to some reasons I cant share the code.

    Any wild guesses?
    Thanks....
    We are not fortune tellers or psychic. No one can determine what makes your program slow without seeing what you're doing.
    And moreover this application is written by some other programmer, so now I'm scaring to debug the application for finding the reason for the delay in generating the output file
    But isn't that what programmers are supposed to do at some point in their programming lives, and that is to debug other people's code? If you're scared to debug it, how in the world are you going to fix it?

    Regards,

    Paul McKenzie
    Last edited by Paul McKenzie; May 5th, 2005 at 10:03 AM.

  12. #27
    Join Date
    Jul 2003
    Posts
    731

    Re: Why my application is so LAZY? Please help me out!!!!

    I think you maybe using MFC's CArray class with structures having static members? This can dramatically slow down your application. This because CArray is have this problem. If you are using this class, I strongly recommend eleminating this using other options.

  13. #28
    Join Date
    Apr 1999
    Posts
    27,449

    Re: Why my application is so LAZY? Please help me out!!!!

    He also may be calling malloc() and free() a million times.

    The problem is that the poster has yet to reveal *any* code to us, so guessing what is wrong won't be productive.

    Regards,

    Paul McKenzie

  14. #29
    Join Date
    Apr 2005
    Location
    INDIA
    Posts
    35

    Talking Re: Why my application is so LAZY? Please help me out!!!!

    I have parsed a text file of about 25 mb and stored the data into database table.
    Its taking just 37 minutes to do that on a PIV,256 MB Machine.
    VC++ is really too fast in parsing files ur extraction and calculation routine has got the problem.

    I am sure, try using interger datatypes in places of floats where not required.

    Regards
    PS

  15. #30
    Join Date
    Jan 2005
    Posts
    148

    Re: Why my application is so LAZY? Please help me out!!!!


    I'm extreamly sorry for giving you trouble. It's my mistake, I did not checked the code properly.
    I found the problem.

    sleep() function is called in my application !!!

    If possible forgive me.

    Thanks to all......

    With Regards........

Page 2 of 3 FirstFirst 123 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured