Qazek Posted June 15, 2013 Author Share Posted June 15, 2013 Hello!I have one question about optimalization server and client data sending.Is it a good idea to change data types from Long to Byte?For example:Edited ver of SendAddChar Sub:```Public Sub SendAddChar(ByVal name As String, ByVal Sex As Byte, ByVal ClassNum As Byte, ByVal Sprite As Byte)Dim buffer As clsBuffer ' If debug mode, handle error then exit out If Options.Debug = 1 Then On Error GoTo errorhandler Set buffer = New clsBuffer buffer.WriteLong CAddChar buffer.WriteString name buffer.WriteByte Sex buffer.WriteByte ClassNum buffer.WriteByte Sprite SendData buffer.ToArray() Set buffer = Nothing ' Error handler Exit Suberrorhandler: HandleError "SendAddChar", "modClientTCP", Err.Number, Err.Description, Err.Source, Err.HelpContext Err.Clear Exit SubEnd Sub```And here is original ver:```Public Sub SendAddChar(ByVal name As String, ByVal Sex As Long, ByVal ClassNum As Long, ByVal Sprite As Long)Dim buffer As clsBuffer ' If debug mode, handle error then exit out If Options.Debug = 1 Then On Error GoTo errorhandler Set buffer = New clsBuffer buffer.WriteLong CAddChar buffer.WriteString name buffer.WriteLong Sex buffer.WriteLong ClassNum buffer.WriteLong Sprite SendData buffer.ToArray() Set buffer = Nothing ' Error handler Exit Suberrorhandler: HandleError "SendAddChar", "modClientTCP", Err.Number, Err.Description, Err.Source, Err.HelpContext Err.Clear Exit SubEnd Sub``` Link to comment Share on other sites More sharing options...
Wortel Angels Posted June 15, 2013 Share Posted June 15, 2013 Long > ByteIf you dont hve more than 255 sprites, classes e.c.t. what you changed then use byte its an lower size and with that faster ;-) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now