Tutorial Found at : Saqib Sajjad's Visual Basic page
Just thought I'd share something interesting I've found since most people just have VB6 sources, and this could help make your server faster, and what with the whole development of Holograph Emulator I think you guys should try these basic optimizations for it you don't really have to but you can. if you want more, theres 3 pages on coding optimization well theres 5 but they're all at justvb.net and if you want more I recommend you go on google and type in "VB6 Coding Optimizations" or anything like that and you'll find tutorials and stuff. :] Also posted this because I'm sick of all the damn Tutorials everyone keeps posting everyone of them is about making a server god damn we should just make a big one, sticky it and ban all "how-to-make-a-server" tutorials damnit yo, someone just make one that covers everything and have a mod sticky it cause they seriously are annoying. Anyways just thought I'd share this, which will be bombarded by all the "how-to-make-a-retro" threads but oh well....
Anyways here is the easiest part of the tutorial I wont modify it, but if you need help with it, just ask or PM me. My hint is where it tells you what to use instead of certain things use the replace function of vb6 and find the code and replace it with whatever he tells you would make the coding faster anyways heres the tutorial :
Assigning an empty string to a variable
PA This is the usual way to clear a string variable.
Text$ = ""
What a waste! First of all, the string "" takes 6 bytes of RAM each time you use it. Consider the alternative:
Text$ = vbNullString
So what is this? vbNullString is a special VB constant that denotes a
null string. The "" literal is an
empty string. There's an important difference. An empty string is a real string. A null string is not. It is just a zero. If you know the C language, vbNullString is the equivalent of NULL.
For most purposes, vbNullString is equivalent to "" in VB. The only practical difference is that vbNullString is faster to assign and process and it takes less memory.
If you call some non-VB API or component, test the calls with vbNullString before distributing your application. The function you're calling might not check for a NULL string, in which case it might crash. Non-VB functions should check for NULL before processing a string parameter. With bad luck, the particular function you're calling does not do that. In this case, use "". Usually APIs do support vbNullString and they can even perform better with it!
No variants please
It's a simple thing but often overlooked. All variables, parameters and functions should have a defined data type. If the data is a string, then the data type should be defined as string. If you don't give a data type, you're using a variant. The variant data type has its uses but not in string processing. A variant means performance loss in most cases.
PA So add those Option Explicit statements now and Dim all variables with a decent data type. Review your functions and ensure that they define a return data type.
Dollars that make your program run faster
PA The following functions unoptimal if you're using them on strings.
Left(), Mid(), Right(), Chr(), ChrW(),
UCase(), LCase(), LTrim(), RTrim(), Trim(),
Space(), String(), Format(), Hex(), Oct(),
Str(), Error
These are the dreaded variant functions. They take a variant, they return a variant. These functions are OK to use if you're processing variants. This is the case in database programming, where your input may contain Null values.
So what's all that variant stuff in string processing? It's fat. If you're dealing with strings, forget about the variants. Use the string versions instead:
Left$(), Mid$(), Right$(), Chr$(), ChrW$(),
UCase$(), LCase$(), LTrim$(), RTrim$(), Trim$(),
Space$(), String$(), Format$(), Hex$(), Oct$(),
Str$(), Error$
---------------------
Alright thanks for your time, if any was given....
Maybe later I'll post more tutorials...
and if anyone says this has nothing to do with retros or habbo...
You're an idiot most servers are CODED in VB6 so shut up. :] Kay thanks.
This can also be used for VB6 coding in general not just retro server
development but I don't think you guys are too slow to figure that out...