VBBot/Performance Tips
From Botdom Wiki
< VBBot
| → |
It is suggested that this page should be moved to Botdom Documentation. Please do not move the page by hand. It will be moved by an administrator with the full edit history. In the meantime, you may continue to edit the page as normal. You can discuss this decision on the talk page. |
Performance tips:
- Run "
NGen install foo.exe/dll" This converts MSIL (the assembly language that .NET Generates) to Highly Optimized Assembly code for your computer. This CANNOT be done at compile time as the machine that the native image was created on is the only machine it can execute on. (this is mostly for me, execpt for those of you who write DLL Based plugins.
- AVOID Try, Catch, Finally blocks. This is because these blocks are the equavilent of If(!statement1) GoTo Catch; if(!statement2) GoTo Catch; if(!statementN) GoTo Catch; Goto EndTry; Catch: CatchStuffHere(); EndTry:
- Use StringBuilder instead of string if the string is to be modified more then 5 times. The reason for this is Strings are immutable (Not able to be modified) and a new copy of the string must be created each time you modify the string. The stringbuilder class has some overhead which is equal to 4-8 modifications of a string. But StringBuilder is Mutable.
- Call Object.Dispose() whenever possiable to reduce garbage collections. Then set the object to null. (Nothing in VB)
- When comparing strings use MyVar.Equals(MyVar2) to compare. Avoid the = operator.
- Avoid Global variables AT ALL COSTS, Less Global Variables means less generation 2 garbage collections. Generation 2 garbage collections are far more expensive then Generation 0 or 1.

