Atlanta Custom Software Development 

 
   Search        Code/Page
 

User Login
Email

Password

 

Forgot the Password?
Services
» Web Development
» Maintenance
» Data Integration/BI
» Information Management
Programming
  Database
Automation
OS/Networking
Graphics
Links
Tools
» Regular Expr Tester
» Free Tools

Improve String Concatenation Performance
[ All Languages » VB »  String]

Total Hit ( 3062)

Rate this article:     Poor     Excellent 

 Submit Your Question/Comment about this article

Rating


 


Click here to copy the following block
'     ========================================
'
'      20 times Faster
'
'     VB work for concatenation
'     =========================
'     1. Allocates temporary memory large enough to hold the result.
'     2. Copies Dest to the start of the temporary area.
'     3. Copies Source to the end of the temporary area.
'     4. De-allocates the old copy of Dest.
'     5. Allocates memory for Dest large enough to hold the result.
'     6. Copies the temporary data to Dest.
     
     
'     Faster Concatenation
'     ====================
     
Sub Concat(Dest As String, Source As String)
'First Dest must have one space more
'Example : Dest = 'Hello '
'and not Dest = 'Hello'

  Dim string1 As Long
  Dim string2 As Long
  
  string1 = Len(Dest)
  string2 = Len(Source)

  Dest = Dest & Space$(string2)
     
  Mid$(Dest, string1, string2) = Source
End Sub


Submitted By : Nayan Patel  (Member Since : 5/26/2004 12:23:06 PM)

Job Description : He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting.
View all (893) submissions by this author  (Birth Date : 7/14/1981 )


Home   |  Comment   |  Contact Us   |  Privacy Policy   |  Terms & Conditions   |  BlogsZappySys

© 2008 BinaryWorld LLC. All rights reserved.