Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

efficient string concatenation 1

Status
Not open for further replies.

Geates

Programmer
Aug 25, 2009
1,566
US
I wrote an Asset Audit and Management program for our organization. One of the functions of it is to see all the logons for a particular asset. However, the more logons audited, the less efficient basic string concatenation (string1 = string1 & string2) becomes.

As an example, suppose I want to audit all the logons that occured on our Citrix box. As one can image, there are tens of thousands. Using basic string concatenation 10,000 times is taxing on system resources and often results in the program Not Responding.

Any suggestions for a more efficient string concatenation function?

-Geates



"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live."
- Martin Golding
 
Ah, I have a solution.

Store the logons in an array and then join the elements. It is MUCH faster.

-Geates

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live."
- Martin Golding
 
If anyone is curious, the link below quickly compares the efficacy of 3 concatenation method; Natvie, Array, and Stream.


-Geates

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live."
- Martin Golding
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top