Results 1 to 6 of 6

Thread: General Info on Optimization

  1. #1

    Thread Starter
    Addicted Member Codehammer's Avatar
    Join Date
    Aug 2004
    Posts
    164

    General Info on Optimization

    have this Sub that will test a particular Condition every time even though it will always be the Same.

    There are around 4 Subs that Exist + 2 Other Completly Different onces.

    I thought of Testing the particulat condition once, then go to the Sub relevant, which then has no test.

    if the Condition is False(above) then do something else, which makes means I duplicate the first Sub's Else Condition. Therefore 8 Subs will now exist(4x2) + the Other non Related onces.

    Here's What I thought:
    If I test each time in the sub for each Parameter, it will still be faster as having 8 Subs + 2 means the Program is Larger, taking up more space in Memory as Windows usually Loads the Entire App into memory?
    Whats your opinion?
    I Noticed just making a App with No Functionality runs At 11 MB in Memory!!
    Curiosity SKILLED the cat
    Google Talk from your Mobile phone

    Chat from your mobile or get an emulator like J2ME Wireless Toolkit 2.2

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: General Info on Optimization

    A few methods will take up next to no memory. You would want to be making a substantial difference to the memory footprint to sacrifice performance. Can't really say more than that because I'm afraid I don't really understand your description of the method relationships.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3
    Frenzied Member ntg's Avatar
    Join Date
    Sep 2004
    Posts
    1,449

    Re: General Info on Optimization

    Quote Originally Posted by Codehammer
    I Noticed just making a App with No Functionality runs At 11 MB in Memory!!
    Win forms projects do that - this is because of what gets loaded for such projects (mscorlib.dll, forms.dll, system.dll, drawing.dll). Don't sweat it as this is normal for .Net apps, which are generally more memory-intensive than COM apps.
    "Feel the force...read the source..."
    Utilities: POPFileDebugViewProcess ExplorerWiresharkKeePassUltraVNCPic2Ascii
    .Net tools & open source: DotNetNukelog4NetCLRProfiler
    My open source projects: Thales SimulatorEFT CalculatorSystem Info ReporterVSS2SVNIBAN Functions
    Customer quote: "If the server has a RAID array, why should we bother with backups?"
    Programmer quote: "I never comment my code. Something that is hard to write should be impossible to comprehend."
    Ignorant quote: "I have no respect for universities, as they teach not practicle stuff, and charge money for"

  4. #4
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,106

    Re: General Info on Optimization

    There is a performance penalty for an If statement. However, if your program is so demanding that this kind of a penalty is even noticeable, you shouldn't be using .NET for the project.

    As for memory footprints: Memory is cheap. I just bought a new computer that has twelve times as much system memory as my first hard drive did, and there are plenty of people here who have even higher ratios. Expect this trend to continue. System memory of 1-2 GB will probably be standard within a year, so what difference does it make if you have a few extra KB. Sure, it could be seen as sloppiness, but if you are trading extra size for extra efficiency, I would go for the extra size every time (except for embedded systems).
    My usual boring signature: Nothing

  5. #5

    Thread Starter
    Addicted Member Codehammer's Avatar
    Join Date
    Aug 2004
    Posts
    164

    Re: General Info on Optimization

    A Image that I Embeded in the Project is called when A specific condition is reached and displays. After reading the Stream I Flush the Stream, then Close it.

    last Nighti noticed the App at 5MB in Memory, then I tried to Write a CD and the Buffer was So low in the system, I had to first End a Few Apps.
    Maybe the Flush in the Code =- =What does that do opposed to .close?
    Curiosity SKILLED the cat
    Google Talk from your Mobile phone

    Chat from your mobile or get an emulator like J2ME Wireless Toolkit 2.2

  6. #6

    Thread Starter
    Addicted Member Codehammer's Avatar
    Join Date
    Aug 2004
    Posts
    164

    Re: General Info on Optimization

    A Image that I Embeded in the Project is called when A specific condition is reached and displays. After reading the Stream I Flush the Stream, then Close it.

    last Night I noticed the App at 5MB in Memory, then I tried to Write a CD and the Buffer was So low in the system, I had to first End a Few Apps.
    Maybe the Flush in the Code =- =What does that do opposed to .close?
    Curiosity SKILLED the cat
    Google Talk from your Mobile phone

    Chat from your mobile or get an emulator like J2ME Wireless Toolkit 2.2

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