Results 1 to 6 of 6

Thread: How Can I Keep my program running smooth??

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 2000
    Posts
    54

    How Can I Keep my program running smooth??

    Hey
    I've been writing this program for about a week now, and its just getting larger and larger in size. And I've noticed that the program is starting to run much slower. Forms will half disapear and then a few seconds later completely disapear. and the transition time between going from one form to the other is much longer.
    Is there some kind of tips you guys use to keep programs running smooth, and take up less memory?

    Thanks in advance for any suggestions / comments..

    ~Jason

  2. #2
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    Well first off,
    check the code to make sure you're not doing something stupid.
    VB Code:
    1. For i = 0 To 100
    2.     Form1.Show
    3. Next i

    Then try the normal code optimization procedures.
    Use faster data types, eg. the Long data type.
    Try to reduce the code required for particular things.

    Try not to have replicated code.
    Write Subs/Functions to avoid this.

    Erase un-needed arrays, avoid large dynamic arrays, unload un-needed objects etc.


    Also try to keep frequently used pieces of data in memory as opposed to loading from the drive or elsewhere...
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  3. #3
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    I'm pretty sure setting a string to "" when you're done using it and if you have a bit more code to execute before it goes out of scope will free some memory.

    Use faster data types, eg. the Long data type.
    I was thinking, since modern 32 CPU are 32-bit, wouldn't VB's Integers have to be converted to 32-bits before the CPU can work with them?

    Try not to have replicated code.
    Write Subs/Functions to avoid this.
    While I agree with because you'll have better source code, wouldn't not doing this make a faster running app?
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

  4. #4

    Thread Starter
    Member
    Join Date
    Aug 2000
    Posts
    54
    Is it better to load and unload a form each time You have to use it, and when your done using it?
    Or should you load everything up at the start?

  5. #5
    New Member
    Join Date
    Aug 2001
    Location
    North Arkansas, US
    Posts
    4

    Wink

    actually it will make the program take less memory (even after being fully compiled) So you sort of trade off a little bit of time for free memory space and remeber as soon as you program hits virtural memory it cuts to 1/10th the speed.

    -j0hn

  6. #6
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    Well its best to use the Long, because *anything* else has to be converted first.

    .. well ya know what I mean ...
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

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