String Concatenation Component

Introduction

I wrote this component - StrCat.Catter - because string concatenation in Visual Basic (Script) has poor performance characteristics. I found that code like this:

<%
  Dim rs
  Set rs = ExecuteSql("SELECT Username FROM Users")

  Dim some_str
  some_str = ""

  do until rs.EOF
    some_str = some_str & rs(0) & "<br>" & vbCrLf
    rs.MoveNext
  loop

  Response.Write some_str
%>

performed very poorly. The code took a long time to execute, during which time the processor was totally saturated. I found articles on MSDN stating that this type of code was a bad idea, and I've heard that this type of concatenation results in run times that are proportional to the square of the number of concatenations.

You might also like...

Comments

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.” - Brian Kernighan