Little River Software
Home -> Articles -> String Vs Array
Little River Software - Custom PHP Software Design and Programming
The String Size Problem

The ASP Method

The Requirements

To resolve the problem we did some tests. Our requirements included the following:

  • Build a variety of long strings.
  • Do something to the strings. Preferably a 'typical' string function. Such as an append, or replacing a portion of the string with another string.
  • Time the process for later comparison.
  • Build a variety of long strings.
  • Split our long strings into an array of smaller strings. (Fortunately due to the nature of our application, we had 'dependable' points at which we could break the string without causing further problems. The technique we used requires a dependable point at which a line can be broken. As our long strings we essentially documents, we could use the line break to split documents into more manageable fragments.)
  • Do something to the array of strings. Preferably a 'typical' string function. Such as an append, or replacing a portion of the string with another string.
  • Recombine the array of smaller strings into a long string
  • Time the process for later comparison.

We also wanted answers to a few other questions:

  • Which is better at string handling, PHP or ASP?
  • Does the problem affect both PHP and ASP, and to what degree?
  • Is the problem surmountable?
  • Will the solution continue to perform as the number and size of documents grows?
  • If PHP looked promising, does PHP perform better under Windows or Linux.

We created 2 test programs, one in ASP and one in PHP. As far as possible (in terms of what they were trying to do and how they did it) we kept these programs the same.

The String Size Problem

The ASP Method